Original Post
I have a window (hwnd_main) that has a modeless child dialog box (hwnd_child). ''hwnd_child'' is a popup dialog box with a few edit boxes on it.
While I am able to click on any of the edit boxes in hwnd_child, I can''t edit them with the keyboard (but I can copy/paste text into them).
This has me baffled. I have tried everything I can think of. I have changed every seemingly-relevent flag, I have tried explicitly using SetFocus() to the set the keyboard focus to these edit boxes, etc.
Here are some random tidbits that may be helpful to determine the problem:
- When the WM_INITDIALOG is processed for hwnd_child, I set the focus to hwnd_main.
- Running the following code produces a massive amount of messageboxes, but suddenly allows me to type text into the edit boxes in hwnd_child.
Excerpt from hwnd_child DlgProc():
- Here is my message pump code:
I know that this bug has something to do with which window/control has the current keyboard focus, but I can''t seem to figure out a solution.
Any thoughts?
-Mike
case WM_MOUSEMOVE:
{
HWND hCurFocusWnd = GetFocus();
if(hCurFocusWnd == hwnd_child)
MessageBox(0,"hwnd_child has focus",0,0);
else
MessageBox(0,"hwnd_child doesn''t have focus",0,0);
return 0;
}
MSG msg;
//as long as m_bShutdown==false, the program will run through this loop
while(!m_bShutdown)
{
if( GetMessage( &msg, NULL, 0, 0 ) )
if(!IsDialogMessage(msg.hwnd, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}