Click here to Skip to main content
15,665,276 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I have a dialog which is derived from CDialog (Modal ) .Now when I press window+D to minimize all the windows and again when I restore the dialog then all the control over it get disapper which only reappear when I move the dialog window.
Why it is happening so and how to fix this .

What I have tried:

I believe RedrawWindow window will do the trick but don't know where to implement this. Which event is going to get hit upon restoring the window through window+D click.
Updated 19-Jun-20 10:30am
Mohibur Rashid 13-Jun-18 10:04am    
Does this help?
iampradeepsharma 13-Jun-18 10:07am    
no this api is not present in the MFC dialog.
Richard MacCutchan 13-Jun-18 10:29am    
The dialog, like any Window, should repaint itself when it gets restored. You need to look into your code to try and see what may be missing.


That's the only method that worked for me as I was looking for a solution.
Share this answer
On restoring after minimise, OnSize[^] is called with nType set to SIZE_RESTORED.

Normally the window would redraw itself automatically though. If you're already using OnSize, check to make sure you're calling the base class' function.
Share this answer
iampradeepsharma 14-Jun-18 4:15am    
OnSize isn't even getting called . I just said it is happening upon pressing window+D as key for minimizing everything and then restoring it using the same key combination.
[no name] 14-Jun-18 4:18am    
Is your application doing processing on the main thread?
iampradeepsharma 25-Jun-18 4:48am    
what is the event which is called when you restore your window but not necessarily activating that window ?
By intercepting the WM_NCPAINT and calling the RedrawWindow() along with the base class handler I could refresh the dialog .
Thanks all .
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900