Link to home
Start Free TrialLog in
Avatar of Sparky-Plug
Sparky-Plug

asked on

C++ Start app minimized

Is there a simple way of making the C++ program run minimized? If it is any easier I suppose that altogether hidden would do.

The app reoganizes many files and it takes a while to complete so it would be more convienient for it to start minimized.

It is not a windows app c++ app but a simple command line type program.

Many thanks.
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of xassets
xassets

If it has a window, sent a WM_MINIMIZE to your own hWnd, using sendmessage or postmessage

If it hasn't got a window and is starting in a command prompt black window, change the compiler/linker options to remove _CONSOLE as in this Q..

https://www.experts-exchange.com/questions/20855554/Converting-a-C-console-application-to-become-windowless.html

That will get rid of the console window completely. I don't think you can control the console window from the running app to minimise it.
Couple of xtra points (a) I should have said call ShowWindow instead of the minimize, (b) jkr's right, this is a way of fulfilling your need, but it just involves launching a sep process. You could use jkrs solution to call your own exe from itself as long as you carry a flag so it knows when not to launch itself, if you see what I mean.
If you're starting the program from the desktop, you can click on the icon properties and command it to run minimuzed.
Hm, the question is pretty much answered...