Print Page | Close Window

CXTTrayIcon

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=1318
Printed Date: 06 November 2025 at 11:22pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTTrayIcon
Posted By: manoj
Subject: CXTTrayIcon
Date 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




Replies:
Posted By: Oleg
Date 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


Posted By: manoj
Date 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



Posted By: Oleg
Date Posted: 26 October 2004 at 11:36pm

What doesn't work? Set break after

if (hWndPrevious)

hWndPrevious != NULL ?



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Oleg
Date Posted: 27 October 2004 at 2:08pm

https://forum.codejock.com/uploads/oleg/2004-10-27_140819_ti.zip - 2004-10-27_140819_ti.zip

you need to override CreateMinimizeWnd. see sample.



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net