Direct X9 and dialog boxes

Started by
4 comments, last by valles 18 years, 4 months ago
I need an example of DXUT used with dialog boxes or someone to correct my code. The new DirectX 9 and DXUT don't have examples of dialog boxes with Direct3d, instead they are all showing the new built in gui they provide. I would like to use the old gui with my system, but can't find any examples. The dialog box I made won't even display until I placed the switch for WM_PAINT in the function. Now it displays, but isn't accepting any mouse input to operate any of the buttons. Here is the code:

LRESULT CALLBACK Picker(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
	HDC hdc;
	PAINTSTRUCT ps;
	switch (message)
	{
		case WM_COMMAND:
			switch( LOWORD(wParam) )
			{
				case IDC_OK:

					break;
				case IDC_CANCEL:
					EndDialog(hDlg, LOWORD(wParam));
					return TRUE;
					break;
			}
			break;

		case WM_PAINT:
			hdc = BeginPaint(hDlg, &ps);
			// TODO: Add any drawing code here...
			EndPaint(hDlg, &ps);
			break;
	}
    return FALSE;
}


this is what is called inside of MsgProc, using the mouse wheel activates my call, the messagebox runs fine, but my dialogbox doesn't:

		case WM_MOUSEWHEEL:
			MessageBox(NULL,L"createdialog", L"HAHA2", MB_OK);
			DialogBox(NULL, (LPCTSTR)IDD_PICKER, hWnd, (DLGPROC)Picker);
			break;


Here are the two pics I have, the first is of what a dialog box should look like, and the second is what my dialog box looks like. pic1
pic2
Any examples or help is appreciated. - Valles
Advertisement
Images don't work.

Edit: They do now.

[Edited by - Mike2343 on November 29, 2005 11:51:18 AM]

"Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety." --Benjamin Franklin

did you use "child window" style??try the "popup"?
Also, keyboard is working? You can tab to the buttons and select ok/cancel?

Edit: I would also try removing the LOWORD(wParam) part and have just it as wParam. That's what I do and my dialogs work fine.

"Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety." --Benjamin Franklin

Removing LOWORD does not work, and tab does not work, windows does the thing where it beeps at me when I try to do something that is not accessible. I will try to find out about these child windows and keep hacking at it until I find a solution.

Apparently there's a whole document on DXUT that explains how to customize it, I'll have to get into depth learning all about DXUT and how MFC works with popups and child windows in order to solve this problem.

- Valles

[Edited by - valles on November 29, 2005 9:07:48 PM]
ARGH!!! I FINALLY GOT IT! Okay, so from VC++ in "Resource View" I doubleclick on my dialog resource, then right click the on the dialog box labeled "TODO: Place dialog controls here", then properties, style and set that to either popup or overlapped.

I went through the trouble of creating DirectX9 code that utilizes DXUT with my own MainLoop. I'll create an article for gamedev as soon as I get a chance, in the mean time if anyone is having a problem with that section of code, go ahead and email me valles_mar@hotmail.com with the subject "DXUT".

Thanks everyone

- Valles

[Edited by - valles on November 30, 2005 12:22:20 PM]

This topic is closed to new replies.

Advertisement