Winapi MessageBox won't close.

So I'm finally buckling down and learning C++; and I already have extensive experience with Windows API from PureBASIC and Visual Basic 6, and in fact have used MessageBox from these languages without problem.
I have a dialog box loaded from a resource template with DialogBox(), and this code in its WndProc:

1
2
3
4
5
6
	case WM_COMMAND:
		if (LOWORD(wParam) == IDCMDTEST)
		{
			int hres = MessageBox(NULL, L"Got click ok.", L"Title", MB_YESNO | MB_ICONINFORMATION);
			return (INT_PTR)TRUE;
		}


The messagebox appears with all parameters displayed correctly, but the red X to close is grayed out, and clicking the buttons does nothing (they don't even go down). I can click the IDCMDTEST button again, and it displays another unclosable MessageBox. I've tried 0 and the dialog hwnd for the first parameter with no change. I did try searching but couldn't find anything relevant.
In Windows MessageBox [x] has the same meaning as Cancel button (or OK, if it is the only button). If Cancel button is not present in message box, close button will be disabled.

Either select something each time dialog box pops up, or change dialogbox style to MB_OKCANCEL or MB_YESNOCANCEL
Topic archived. No new replies allowed.