# Dialog Window's control disappear when i drag the window offscreen

This topic is 2062 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

So I have a dialog window,but if I drag part of it offscreen,the controlls disappear. If I keep getting the mouse over the window parts of them will reappear.

What could be the problem?

##### Share on other sites

Show your message loop and DialogProc.

Could be that you have a HWND set in Get/PeekMessage.

##### Share on other sites
INT_PTR CALLBACK DialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{

int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;
UNREFERENCED_PARAMETER(lParam);
switch (message)
{
case WM_INITDIALOG:
return (INT_PTR)TRUE;

case WM_COMMAND:
wmId    = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case IDOK:

break;
}
break;

case WM_PAINT:
hdc = BeginPaint(hDlg, &ps);
// TODO: Add any drawing code here...
EndPaint(hDlg, &ps);
manager.Clear();

break;
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_CLOSE:
PostQuitMessage(0);
break;

}
return (INT_PTR)FALSE;
}


manager.Clear() is a function call to directx to clear the backbuffer.

Edited by noatom

##### Share on other sites

Sorry. Ignore this. Not enough coffee.

Blah--> Your dialog proc should return DefWindowProc for any unprocessed commands, not 0. Any processed commands should return 0.

Edited by Buckeye

##### Share on other sites

Ok,I corrected that but the controls still disappear...

##### Share on other sites

See my comment above, now rated: "Blah."

Do you have any custom controls or subclassed controls?

EDIT: Does it appear properly if you comment out the call to manager.clear()?

EDIT2: Just to make sure you understand the stupidity of a previous post of mine, the dialog proc should return TRUE if it processes a command, and FALSE if it doesn't. E.g., you might try NOT calling BeginPaint/EndPaint and just return FALSE (or don't include it at all). Also, though you may just be testing it, the IDOK (and maybe IDCANCEL) is normally processed by calling EndDialog and returning TRUE. Returning TRUE (normally) applies to all control messages.

Edited by Buckeye

##### Share on other sites

So the manager.Clear() is the problem.

But where should I place it?!

Edited by noatom

##### Share on other sites

We may have cross-posted. I am really sorry for my previous comment about DefWindowProc. That comment was INCORRECT. Returning FALSE for unprocessed commands and TRUE for processed commands is the correct way to do it. See my later post, just above your last.

Just FYI, the default dialog procedure is owned by Windows. It processes all commands, sending most (but not all) to YOUR dialog proc. The return value from YOUR proc tells the default proc whether you handled it or not.

Edited by Buckeye

##### Share on other sites

so i return true for every message i process, and return false if the message is not processed,ok.

but,im still having the problem. And removing the clear function fixed the problem...but where should i put the clear function?!

##### Share on other sites

I have an idea what it does, but why do you call it from a modal dialog? Can it wait until the dialog closes?

If you want to interface with another object from a dialog (e.g., getting settings, etc., which are to be displayed immediately), you should use a modeless dialog.

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 13
• 18
• 15
• 10
• 9