The problem is:
Windows Message is not returned by WindowProc CALLBACK .Im trying to capture the WM_COMMAND message which is defined in winuser.h.But WindowProc is not returning this message.
Actually i need to capture an Applications new,save,open &close events.All these can be captured only if WindowProc enters into WM_COMMAND case.once this is captured i can trace the wparam value and capture
the above mentioned application events.
Note:This problem comes only in .NET VC++ 2003(im currently working in).
I dont hav any problem capturing the WM_COMMAND message in Native VC++ 6.0!!
Plz tell me y its not coming in .NET VC++ 2003?
Please give me a solution for this problem as soon as possible .Its very urgent.
This is how my code goes:
LRESULT CALLBACK WindowProc( HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
LRESULT retval;
char buf[128];
sprintf(buf,"%d",uMsg);
// MessageBox(NULL,buf,"uMsg",0);
switch(uMsg)
{
case WM_COMMAND:
sprintf(buf,"%d : %d",wParam,lParam);
//MessageBox(NULL,buf,"Art assess",0);
break;
}
retval = CallWindowProc((WNDPROC)pOldProc, hwnd, uMsg, wParam, lParam);
return retval; //Default window message...
}
code snippet where i call this WindowProc:
void MenuInitialize()
{
char buf[200];
HWND wind;
wind=GetForegroundWindow();
SetActiveWindow( wind);
g->illustratorHWND = GetNextWindow(wind, GW_HWNDNEXT);
SetActiveWindow( g->illustratorHWND);
pOldProc = SetWindowLong(g->illustratorHWND, GWL_WNDPROC, (long) WindowProc);
}
Hope u could understand my problem.
Help me soon.