Re: Use DLL for get Windows Message?
Hi Uli,
My currently application is written by another language and it doesn't have
a windows menu, so I create this DLL and a function to load a simple windows
menu (for example File => Exit). Now I need to control the events. The
function should return an windows event. So I can control user menu item
selection.
Now I changed the parameter list. I don't have any input parameters, I have
only return value. It's now an integer parameter (for msg.message or
msg.wParam).
So I changed a little bit my code. If the WM_COMMAND is sending so I should
get the message box but I don't! I only get 3-4 numbers.
For example after starting my application I get the value 512. if I go with
mouse to menu area I get 160 and if I click for example out of my application
on the task, then I get 49321. There are only 3-4 values who change but I
think it's definitive undercharge.
Something is wrong in my code, but what?
PS: Do I need DefWindowProc?
My new code:
__declspec ( dllexport ) int GetMessage(int pReturn)
{
MSG msg;
GetMessage(&msg, NULL, 0, 0);
TranslateMessage( &msg );
DispatchMessage( &msg );
//DefWindowProc(hwnd, msg.message, msg.wParam, msg.lParam);
if(msg.message == WM_COMMAND) MessageBox(NULL, "WM_COMMAND event !!!",
"Title", MB_OK);
return msg.message;
}
les