Using WindowState for starting forms minimized problem

G

Guest

I have an application with several Form based windows. I want to be able to
start the application minimized, so I have a command line parameter to set
WindowState to Minimized.

I set the window state in the OnCreateControl (because if I do it in the
constructor there are some sizing issues) and the window starts minimized.
However, when I restore the window, most of the forms are blank (save for the
last one added). I can see through the debugger that the WindowState is now
Normal, but none of the child controls show.

The app is being restored to the normal size by using ShowWindow( hwnd,
SW_NORMAL), which appears to set all the forms to Normal. I see the app
visually return to normal but only one of the child does so properly.

How are the WindowState property and the ::ShowWindow method related?

Any suggestions on a better way to handle this?

/ken
 
G

Guest

I am wondering where the proper place is to set the WindowState to minimized.

If I create a shortcut, I can set the Run property to Minimized. Is this
the same as using the shell "Start /min myapp.exe" from a command prompt?
This doesn't seem to cause any sizing problems for my apps forms.

How does this set the WindowState to minimized and what else is performed by
the shell command? (Is it just sending a WS_MINIMIZE message to the app and
if so, how can I replicate this internally using WindowsState?)

/ken
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top