so where should i call ShowWindow again in my test program?
and do you mean like this:
Code:ShowWindow(hWnd, SW_SHOW );
Printable View
so where should i call ShowWindow again in my test program?
and do you mean like this:
Code:ShowWindow(hWnd, SW_SHOW );
Where you want to.
But you must be sure (you have to test it!) that this second call is really executed.
ok adding the line ShowWindow(hWnd, SW_SHOW ); to the test program causes the window to be displayed when i run createprocess
Good! So now you know a possible reason for the external program to be displayd despite of your startup parameter set to SW_HIDE! :thumb:
ok so how do i solve this problem? what code do i need to hide the window?
Well, the best way would be to change this external program so it will never call ShowWindow with any but SW_SHOWDEFAULT parameter.
It you cannot change this program then you could try with (WH_CBT) HOOK...
i can't change the external program so could you show some code for (WH_CBT) HOOK?
No, I cannot. But you could make a Google search for something like global hook WH_CBT example
ok hook be used in a c++ console application? examples on google only seem to be showing examples in win32
What "c++ console application" are you talking about? What is a problem with a "console application"?
my createprocess program is a console application (the code i put in the first post). can i add hook WH_CBT to this?
No, you need to create a HOOL dll to hook an external applications!
i have never used HOOK before. is there an easier way to hide the window of the external program?
Well, the one and only one way to hide the window is to call ShowWindow with SW_HIDE for this window (or its parent)
So if you know the handle of the main window of this external program then you could try to hide it.
But the question is how often you will have to repeat it! What if this external program tries to maximize or restore its main window every second?
i don't know anything about the code of the external program.. so i guess SW_HIDE isn't a good option then