Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Restoring minimized application

Brooks_Van_Horn
New Contributor I
373 Views

Just developing a gui-dialog based application that controls the graphics drawn in the main window. When I minimize the app all seems ok. When I try to maximize it it leaves nothing intact. The dialog is sort of greyed out and the main window is all white. While minimized to the tray I can put my mouse over the small display and when I select the small window, it pops my app up and all looks good until I release the mouse button. What am I ignoring or should I do something in the WM_QUERYOPEN message? Is this a simple thing or do I need to design this exchange in my code...like saving values when minimized and then restoring them when maximized?

Thanks,

Brooks Van Horn

0 Kudos
1 Solution
IanH
Honored Contributor II
373 Views

Based on your original description, it sounds like your window has been disabled.

Are you overriding a dialog window (one that is displayed by CreateDialog or similar) or do you have a "normal" application window with an embedded dialog, or are you managing the controls in the screenshot yourself? 

If the former, interaction with the windows dialog manager can be tricky - if it doesn't get a message that it was expecting then you could see strange behaviour.  A more robust approach would be to have things like the chart drawing code in its own control that is a sibling to the other dialog controls - customisation through the dialog procedure proper is then limited to passing notifications between the sibling controls in order to implement the higher level program logic.

Remember that we cannot see your code - it is impossible to understand what you are doing from a scant paragraph of high level description.

You can inspect changes in the flags in the WM_SIZE message to see if you are being restored (see also the IsIconic API), but why do you care?    From memory (and because I typically work through a framework it has been a while since I've had to deal with any of this detail) there isn't any specific code that you need to provide to get sensible handling of minimized/restored/maximized window state.

The image that the operating system shows when you hover over the task bar icon for your minimized window may just be from an image of the window captured by the operating system as part of desktop composition, immediately prior to you minimizing the window - it may not actually represent the state of the minimized window - typically (historically) a minimized window wouldn't draw anything because there is nothing to draw into.

View solution in original post

0 Kudos
6 Replies
andrew_4619
Honored Contributor II
373 Views

The maximise will cause a WM_PAINT message and you should draw graphics element within the WinProc in response. 

0 Kudos
Brooks_Van_Horn
New Contributor I
373 Views

How can I tell if I'm being restored? Via wm_size?

Brooks

PS, I'm uploading a pdf of my graphics and dialog so far.

0 Kudos
IanH
Honored Contributor II
374 Views

Based on your original description, it sounds like your window has been disabled.

Are you overriding a dialog window (one that is displayed by CreateDialog or similar) or do you have a "normal" application window with an embedded dialog, or are you managing the controls in the screenshot yourself? 

If the former, interaction with the windows dialog manager can be tricky - if it doesn't get a message that it was expecting then you could see strange behaviour.  A more robust approach would be to have things like the chart drawing code in its own control that is a sibling to the other dialog controls - customisation through the dialog procedure proper is then limited to passing notifications between the sibling controls in order to implement the higher level program logic.

Remember that we cannot see your code - it is impossible to understand what you are doing from a scant paragraph of high level description.

You can inspect changes in the flags in the WM_SIZE message to see if you are being restored (see also the IsIconic API), but why do you care?    From memory (and because I typically work through a framework it has been a while since I've had to deal with any of this detail) there isn't any specific code that you need to provide to get sensible handling of minimized/restored/maximized window state.

The image that the operating system shows when you hover over the task bar icon for your minimized window may just be from an image of the window captured by the operating system as part of desktop composition, immediately prior to you minimizing the window - it may not actually represent the state of the minimized window - typically (historically) a minimized window wouldn't draw anything because there is nothing to draw into.

0 Kudos
Brooks_Van_Horn
New Contributor I
373 Views

Thanks, I have a lot to consider. For right now, I cludged some code in the WM_SIZE and then I intervened in WM_PAINT to something special when I find the WM_SIZE event told me it was invoked. I know this is rambling but some health issues have me jittery. Been a Type I diabetic for 59 years.

 

Brooks

0 Kudos
NotThatItMatters
Beginner
373 Views

Brooks,

Keep the diabetes in control.  I have been a type I for 43 years and know what low blood sugar can do to your code (and your life).

0 Kudos
Brooks_Van_Horn
New Contributor I
373 Views

Andrew, sorry to hear that. Keep the faith because I should have been dead 30 years ago. Test strips and no BS meters for most of my life. I have very little vision (22,000 laser burns) and by-pass surgery in '02. BTW, do you know anything about printing. I can get a DC for the printer but when I print all I get is a blank page. I tried drawing into the printer DC and bitblt into it but just blank pages. Tried on Lexmark laser and Epson 3-in-1.

Brooks

0 Kudos
Reply