Unmanaged DLL used by C# WPF app not receiving WM_DEVICECHANGE
-
I have a WPF application which loads two C++ DLLs. Each DLL creates a window and registers it to receive WM_DEVICECHANGE messages to detect when our hardware is connected and removed. This works fine when using one DLL. But when we use two, the second one does not receive the expected WM_DEVICECHANGE messages. And for some strange reason, the main WPF window DOES receive them. Does anyone know what is going on? And how to fix this?
-
I have a WPF application which loads two C++ DLLs. Each DLL creates a window and registers it to receive WM_DEVICECHANGE messages to detect when our hardware is connected and removed. This works fine when using one DLL. But when we use two, the second one does not receive the expected WM_DEVICECHANGE messages. And for some strange reason, the main WPF window DOES receive them. Does anyone know what is going on? And how to fix this?
Leif Simon Goodwin wrote:
This works fine when using one DLL. But when we use two, the second one does not receive the expected WM_DEVICECHANGE messages.
What if you temporarily disabled the one DLL that currently works, does the other DLL then start receiving the the
WM_DEVICECHANGE
message?"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
-
Leif Simon Goodwin wrote:
This works fine when using one DLL. But when we use two, the second one does not receive the expected WM_DEVICECHANGE messages.
What if you temporarily disabled the one DLL that currently works, does the other DLL then start receiving the the
WM_DEVICECHANGE
message?"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
That is too complex to do, but if I create a dummy WPF or WinForms project using the one that did not work, it works.
-
I have a WPF application which loads two C++ DLLs. Each DLL creates a window and registers it to receive WM_DEVICECHANGE messages to detect when our hardware is connected and removed. This works fine when using one DLL. But when we use two, the second one does not receive the expected WM_DEVICECHANGE messages. And for some strange reason, the main WPF window DOES receive them. Does anyone know what is going on? And how to fix this?
The person who wrote the DLLs used the same name for the message window in each DLL hence the bug!