V
Victor Winters
I am using instances of MessageWindow class throughout my application. It has worked flawlessly up to this point. Here's my steps:
1. Create MessageWindow class.
2. Send Hwnd to unmanaged code (I have a dll I created in evc).
3. Save the Hwnd to a variable in the dll.
4. At some point the dll invokes SendMessage to this Hwnd.
The MessageWindow on the managed side never responds. If I create the same message using the Message class on the managed side and SendMessage with that, it works. Here is the code:
managed code (register mAppMessages (a MessageWindow) to unmanaged side)
Library.RegisterMessageHandler(mAppMessages.Hwnd);
unmanaged code saves Hwnd
HWND mMessageHandler;
__declspec( dllexport ) void RegisterMessageHandler(HWND hwnd)
{
mMessageHandler = hwnd;
}
unmanaged code sends message
SendMessage(mMessageHandler, WM_ACTIVATE, 9, 12345);
Nothing happens. But when I do this on the managed side it works
Message msg = Message.Create(mAppMessages.Hwnd, Library.WM_ACTIVATE, (IntPtr)9, (IntPtr)12345);
MessageWindow.SendMessage(ref msg);
Thanks Victor
1. Create MessageWindow class.
2. Send Hwnd to unmanaged code (I have a dll I created in evc).
3. Save the Hwnd to a variable in the dll.
4. At some point the dll invokes SendMessage to this Hwnd.
The MessageWindow on the managed side never responds. If I create the same message using the Message class on the managed side and SendMessage with that, it works. Here is the code:
managed code (register mAppMessages (a MessageWindow) to unmanaged side)
Library.RegisterMessageHandler(mAppMessages.Hwnd);
unmanaged code saves Hwnd
HWND mMessageHandler;
__declspec( dllexport ) void RegisterMessageHandler(HWND hwnd)
{
mMessageHandler = hwnd;
}
unmanaged code sends message
SendMessage(mMessageHandler, WM_ACTIVATE, 9, 12345);
Nothing happens. But when I do this on the managed side it works
Message msg = Message.Create(mAppMessages.Hwnd, Library.WM_ACTIVATE, (IntPtr)9, (IntPtr)12345);
MessageWindow.SendMessage(ref msg);
Thanks Victor