#88505# Quickstart.exe param -killtray terminates system tray icon
This commit is contained in:
parent
8349cdfd5e
commit
f76b8f7d95
2 changed files with 38 additions and 5 deletions
|
@ -2,9 +2,9 @@
|
|||
*
|
||||
* $RCSfile: shutdowniconw32.cxx,v $
|
||||
*
|
||||
* $Revision: 1.12 $
|
||||
* $Revision: 1.13 $
|
||||
*
|
||||
* last change: $Author: pb $ $Date: 2001-08-29 09:25:19 $
|
||||
* last change: $Author: hro $ $Date: 2001-09-18 13:36:53 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@ -150,6 +150,7 @@ using namespace ::osl;
|
|||
#define LISTENER_WINDOWNAME "SO Listener Window"
|
||||
#define EXECUTER_WINDOWCLASS "SO Executer Class"
|
||||
#define EXECUTER_WINDOWNAME "SO Executer Window"
|
||||
#define KILLTRAY_MESSAGE TEXT("SO KillTray")
|
||||
|
||||
#define ID_QUICKSTART 1
|
||||
#define IDM_EXIT 2
|
||||
|
@ -364,6 +365,7 @@ LRESULT CALLBACK listenerWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
|
|||
static HMENU popupMenu = NULL;
|
||||
|
||||
static UINT s_uTaskbarRestart = 0;
|
||||
static UINT s_uMsgKillTray = 0;
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
|
@ -374,6 +376,7 @@ LRESULT CALLBACK listenerWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
|
|||
// request notfication when taskbar is recreated
|
||||
// we then have to add our icon again
|
||||
s_uTaskbarRestart = RegisterWindowMessage(TEXT("TaskbarCreated"));
|
||||
s_uMsgKillTray = RegisterWindowMessage( KILLTRAY_MESSAGE );
|
||||
|
||||
// create the menu
|
||||
if( !popupMenu )
|
||||
|
@ -456,7 +459,19 @@ LRESULT CALLBACK listenerWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
|
|||
// re-create taskbar icon
|
||||
addTaskbarIcon( hWnd );
|
||||
}
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
else if ( uMsg == s_uMsgKillTray )
|
||||
{
|
||||
// delete taskbar icon
|
||||
NOTIFYICONDATAA nid;
|
||||
nid.cbSize=sizeof(NOTIFYICONDATA);
|
||||
nid.hWnd = hWnd;
|
||||
nid.uID = ID_QUICKSTART;
|
||||
Shell_NotifyIconA(NIM_DELETE, &nid);
|
||||
|
||||
SendMessage( hWnd, WM_COMMAND, IDM_EXIT, (LPARAM)hWnd );
|
||||
}
|
||||
else
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -467,8 +482,6 @@ LRESULT CALLBACK executerWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
|
|||
{
|
||||
static HMENU popupMenu = NULL;
|
||||
|
||||
static UINT s_uTaskbarRestart = 0;
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_NCCREATE:
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
#define TERMINATIONVETO_MESSAGE "SO TerminationVeto"
|
||||
#define TERMINATE_MESSAGE "SO Terminate"
|
||||
#define LISTENER_WINDOWCLASS "SO Listener Class"
|
||||
#define KILLTRAY_MESSAGE "SO KillTray"
|
||||
|
||||
static UINT aTerminationVetoMessage = 0x7FFF;
|
||||
static UINT aTerminateMessage = 0x7FFF;
|
||||
static HMENU popupMenu = NULL;
|
||||
|
@ -113,6 +115,24 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
|||
LPSTR lpCmdLine,
|
||||
int nCmdShow)
|
||||
{
|
||||
// Look for -killtray argument
|
||||
|
||||
for ( int i = 1; i < __argc; i++ )
|
||||
{
|
||||
if ( 0 == strcmp( __argv[i], "-killtray" ) )
|
||||
{
|
||||
HWND hwndTray = FindWindow( LISTENER_WINDOWCLASS, NULL );
|
||||
|
||||
if ( hwndTray )
|
||||
{
|
||||
UINT uMsgKillTray = RegisterWindowMessage( KILLTRAY_MESSAGE );
|
||||
SendMessage( hwndTray, uMsgKillTray, 0, 0 );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
launchSoffice();
|
||||
return 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue