Prev: CreateWindow fail when used at WM_CREATE ?
Next: IShellLink::GetPath returns the wrong path. Why?
From: Arif Ali Saiyed on 28 Sep 2009 01:01 Hi there, My requirement is that I want to recevie a messgae when a application is launched....and do something... so what i did i setup a WH_CALLWNDPROC hook ....and i listen for for WM_CREATE and /or WM_NCCREATE... I get message whenever application get's created.. and I do whatever i want ... CWPSTRUCT *wps = (CWPSTRUCT*)lParam; HWND hWnd = (HWND)(wps->hwnd); if(wps->message == WM_NCCREATE ) //WM_CREATE ) { wchar_t processName[256]; ::GetModuleBaseName(::GetCurrentProcess(),0,processName, 256); if(::wcsicmp(processName,L"NOTEPAD.ExE") == 0 ) { // do What i want ...glow//hilight windows change priority etc... } } till here everything is working fine ...no issue ...but i want a message which is sent exactly once .... when window is created for the first time ( when application is launched) ....but I am getting these two messages even when I right click on notepad in taskbar, to invoke the system menu, this is not desired. Can anyone of you tell me which message exatly i should listen for ?
From: Christian ASTOR on 28 Sep 2009 02:41 On 28 sep, 07:01, Arif Ali Saiyed <arif.ali.s...(a)gmail.com> wrote: > till here everything is working fine ...no issue ...but i want a > message which is sent exactly once .... > when window is created for the first time ( when application is > launched) ....but I am getting these two messages > even when I right click on notepad in taskbar, to invoke the system > menu, this is not desired. Because you get the WM_CREATE from the menu window ("#32768") You can test GetClassName() Another method is to use WMI events with Win32_Process class http://msdn.microsoft.com/en-us/library/aa390425(VS.85).aspx
|
Pages: 1 Prev: CreateWindow fail when used at WM_CREATE ? Next: IShellLink::GetPath returns the wrong path. Why? |