G
Guest
Hello,
I have a legacy MFC application that has a lot of editor functionality
associated with a class that extends CFrameWnd. This editor watches for key
down events by using the OnKeyDown handler in the message map. In my legacy
MFC application, my OnKeyDown handler is always called, as I would expect.
I'm calling the legacy application's editor window from within a C#
application. I've written a little C++/CLI application that bridges the
managed code, and exposes a C# friendly method for via explicit p/invoke.
This allows my editor to show up and (generally) work as I'd hope.
The problem is that the OnKeyDown handler in the CFrameWnd based dialog does
not always get called when the window is invoked from my managed code. It
gets called when I use simple keys like 'A' or '1' but if I press the Esc
key, my handler is not called.
Can anyone give any clues as to why my handler is not being called when the
Esc key is pressed? I used Spy++ to look at the messages being sent to the
CFrameWnd based dialog and it is receiving the WM_KEYDOWN message with the
VK_ESCAPE virtual key. Also, in case it matters, in my legacy application,
the window that launches the CFrameWnd based dialog is modeless, while in my
C# application, the window from which the CFrameWnd based dialog is launched
is modal.
Thanks!
Notre
I have a legacy MFC application that has a lot of editor functionality
associated with a class that extends CFrameWnd. This editor watches for key
down events by using the OnKeyDown handler in the message map. In my legacy
MFC application, my OnKeyDown handler is always called, as I would expect.
I'm calling the legacy application's editor window from within a C#
application. I've written a little C++/CLI application that bridges the
managed code, and exposes a C# friendly method for via explicit p/invoke.
This allows my editor to show up and (generally) work as I'd hope.
The problem is that the OnKeyDown handler in the CFrameWnd based dialog does
not always get called when the window is invoked from my managed code. It
gets called when I use simple keys like 'A' or '1' but if I press the Esc
key, my handler is not called.
Can anyone give any clues as to why my handler is not being called when the
Esc key is pressed? I used Spy++ to look at the messages being sent to the
CFrameWnd based dialog and it is receiving the WM_KEYDOWN message with the
VK_ESCAPE virtual key. Also, in case it matters, in my legacy application,
the window that launches the CFrameWnd based dialog is modeless, while in my
C# application, the window from which the CFrameWnd based dialog is launched
is modal.
Thanks!
Notre