I'm createing a custom control from scratch and this control has a dropdown
portion just like combobox...
To have a professional look, I've to take care some points while the
dropdown is shown such as :
1) It should not steal focus from the Form.
2) It should be focusable.
3) It should catch all the mouse events while it's visible.
To achieve this I create the dropdown control and show it like this :
private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
private static extern int SetParent(IntPtr hWndChild,IntPtr hWndNewParent);
private static extern int SetCapture(int hwnd);
--- The code that shows the DropDown portion---
As you can see, I'm setting the parent of the dropdown to desktop. Than
showing the window and setting the capture to that window.
The only succesfull part of the code is that the form does not loose the
focus. But I can't set the focus to the control and neither it captures the
Can anybody point me what I'm doing wrong or know any way to achieve the
effect I want?