Hey guys, I have a stoopid question...
I'm writing an editor for my breakout-style game, and one part of that editor is for a dialog box to pop up for the user to manually input some properties for a selected entity. I can code C++ OK, but I'm really not that good at Windows programming. I've created a Direct3D game window and it operates alright. But when I create a properties dialog box using 'CreateDialog()', the dialog box pops up OK but the focus is still on my main Direct3D window. If I try to click anywhere on that dialog box, nothing happens and the box never goes into focus... Sorta hard to explain, but imagine two windowed programs running where one is 'in focus' and the other is 'out of focus'; the 'in focus' window has the colored bar at the top of the window, and the 'out of focus' window has the greyscaled bar at the top of the window. Now when I'm running my Direct3D editor, the Direct3D main window always has the colored bar at the top of its window (in focus) but the dialog box is ALWAYS greyscaled and cannot be clicked into focus!
Here's how I'm creating my dialog box:
int CreateBlockPropertiesMenu(HWND hWndParent, HINSTANCE hInstance)
{
HWND dlg = CreateDialog(hInstance, // instance handle;
MAKEINTRESOURCE(IDD_PROPPAGE_BLOCKS), // dialog identifier;
hWndParent, // parent/owner handle;
DlgBlockPropProc); // window procedure;
if(dlg==NULL)
return 0;
else
{
ShowWindow( dlg, SW_SHOW);
}
return 0;
}
...and here's how I'm calling up my dialog box:
CreateBlockPropertiesMenu(DXStuff.hWnd, wc.hInstance);
I do have a 'DlgBlockPropProc' message processor, but it isn't being called at all since the properties window never goes into focus. Argh!
'DXStuff.hWnd' is the handler to my main Direct3D window, and 'wc.hInstance' is gotten from the window class of my main Direct3D window. Anyways, when I use 'CreateBlockPropertiesMenu' to create the dialog box, the dialog box appears but is not in focus. And if I add 'SetFocus(dlg)' in my 'CreateBlockPropertiesMenu' function, it returns NULL (MSDN website: "If the hWnd parameter is invalid or the window is not attached to the calling thread's message queue, the return value is NULL.")
When you try to respond to this post, remember that I'm a complete DUMMY when it comes to Windows programming. In other words, my problem is most likely because I've left out something OBVIOUS that everybody else knows to use! If you need to see any more code, lemme know and I'll post it.
Thanks in advance for the help!