Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - CXTTrayIcon
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTTrayIcon

 Post Reply Post Reply
Author
Message
manoj View Drop Down
Newbie
Newbie
Avatar

Joined: 26 October 2004
Location: India
Status: Offline
Points: 31
Post Options Post Options   Thanks (0) Thanks(0)   Quote manoj Quote  Post ReplyReply Direct Link To This Post Topic: CXTTrayIcon
    Posted: 26 October 2004 at 6:15am

I am using CXTTrayIcon in my dialog based application. My version XTToolkit is 9

I want to Maximize my application by another instace of application.

simply i dont want to multiple instance of application if first one is system tray then application should maximized.

pls reply ASAP

Manoj

Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 26 October 2004 at 6:52am

Something like:

BOOL CYourApp::OneInstance(CCommandLineInfo& cmdInfo)
{
 HANDLE hSem = CreateSemaphore(NULL, 1, 1, m_pszAppName);

 if (GetLastError() == ERROR_ALREADY_EXISTS && CMainFrame::m_bOneInstance)
 {
  CloseHandle(hSem);

  HWND hWndPrevious = ::FindWindow("You_Dialog_Class", NULL);
  if (hWndPrevious)
  {
   if (::IsIconic(hWndPrevious))
    ::ShowWindow(hWndPrevious,SW_RESTORE );
   
   ::SetForegroundWindow(::GetLastActivePopup (hWndPrevious));
   
   return FALSE;
  } 
 }

 return TRUE;

}

in BOOL CYourApp::InitInstance():

 

 CCommandLineInfo cmdInfo;
 ParseCommandLine(cmdInfo);

 if (!OneInstance(cmdInfo))
  return FALSE;

 

 

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
manoj View Drop Down
Newbie
Newbie
Avatar

Joined: 26 October 2004
Location: India
Status: Offline
Points: 31
Post Options Post Options   Thanks (0) Thanks(0)   Quote manoj Quote  Post ReplyReply Direct Link To This Post Posted: 26 October 2004 at 7:40am

Above code is not working

I am doing this

in main dialog class

//////////////////////////////////////////////////////////// //////////////
//System Tray

CXTTrayIcon m_TrayIcon;


m_TrayIcon.Create( LoadString(IDS_APP_NAME),
this ,IDR_MAINFRAME,IDR_MENU_SYSTEMTRAY,ID_SYSTEMTRAY_SHOWMAINWIN DOW);
m_TrayIcon.HideIcon();

In initInstanece Function

{

CString strClassName;

strClassName.LoadString(IDS_APP_TITLE);

HWND hWndPrevious = ::FindWindow("#32770", strClassName);

if (hWndPrevious)

{

if (::IsIconic(hWndPrevious))

::ShowWindow(hWndPrevious,SW_RESTORE );

::SetForegroundWindow(::GetLastActivePopup (hWndPrevious));

}

}

return FALSE;

this problem occur if i am using CXTTrayIcon

If I use SDK then above function is working perfectly

Please reply ASAP

Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 26 October 2004 at 11:36pm

What doesn't work? Set break after

if (hWndPrevious)

hWndPrevious != NULL ?

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 27 October 2004 at 2:08pm

2004-10-27_140819_ti.zip

you need to override CreateMinimizeWnd. see sample.

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.047 seconds.