I have a C++ ATL COM component that displays a popup window (plain ol' Win32, using the WS_POPUP style) which allows the user to input some search information. This component has been tested pretty extensively against a VB6 form (primarily for ease of debugging), but we want to use it with .NET winforms.
The curious thing that we found when calling the component from a winforms environment is that certain keystrokes no longer make it through to our popup window. For example: we have subclassed an edit box on the popup to listen for the ESC key and close the popup. In VB6 this works great, but in winforms the popup never receives the keydown event for ESC (it does for other keys, like standard alphanumerics).
Use of the component is pretty trivial, but I'll throw up a quick sample here to head off any questions:
public partial class Form1 : Form
{
CustomPopup panel;
public Form1()
{
panel = new CustomPopup(); //This is the COM object
}
private void button1_Click(object sender, EventArgs e)
{
Point p = this.PointToScreen(button1.Location);
// Display the popup, which gives focus to a child WC_EDIT field
panel.ShowPopupAt(p.X, p.Y);
}
}
As you can see, not much to it. So, any ideas on what in winforms is eating our keystrokes and how we can tell it to stop?