how to receive app launch message?
-
I switch the default desktop to mine,and i produce taskbar myself.So i want to receive some message when system shell is ready to launch an application and to terminate an application. how can i do? hook? or other?
Typically you'd use SetWindowsHookEx with either the WH_CBT or WH_SHELL setting. -- Joel Lucsy
-
Typically you'd use SetWindowsHookEx with either the WH_CBT or WH_SHELL setting. -- Joel Lucsy
-
thank you. But can you give me a demo code?or where can download such demo? thank you again.
-
Hi! You will use WH_CBT hooks and look for HCBT_CREATEWND nCode on your hook proc. You will find an example for this at http://www.codeproject.com/shell/sweeptheminesweeper.asp?target=minesweeper[^] Regards, Bilal Anjum
-
HI! Well according to MSDN (If its wrong it's Microsoft to blame :) )
HSHELL_WINDOWCREATED
will be called when "A top-level, unowned window has been created. The window exists when the system calls a ShellProc function." andHCBT_CREATEWND
will be called when "A window is about to be created. The system calls the hook procedure before sending the WM_CREATE or WM_NCCREATE message to the window. If the hook procedure returns a nonzero value, the system destroys the window; the CreateWindow function returns NULL, but the WM_DESTROY message is not sent to the window. If the hook procedure returns zero, the window is created normally." Regards, Bilal Anjum -
HI! Well according to MSDN (If its wrong it's Microsoft to blame :) )
HSHELL_WINDOWCREATED
will be called when "A top-level, unowned window has been created. The window exists when the system calls a ShellProc function." andHCBT_CREATEWND
will be called when "A window is about to be created. The system calls the hook procedure before sending the WM_CREATE or WM_NCCREATE message to the window. If the hook procedure returns a nonzero value, the system destroys the window; the CreateWindow function returns NULL, but the WM_DESTROY message is not sent to the window. If the hook procedure returns zero, the window is created normally." Regards, Bilal Anjum