ShellExecute SW_HIDE option is not hiding the exe
If i use ShellExecute API to execute "Notepad.exe" with SW_HIDE. It is executing notepad and the notepad is not visible but while checking in Taskmanager it is in running state. But when i try to run other exe with SW_HIDE option, the exe is not hiding. It is visible as in SH_SHOW option.
ShellExecute( NULL, NULL, "Notepad.exe", NULL, NULL, SW_HIDE );
This is working fine
ShellExecute( NULL, "open","checkingexe.exe", NULL, "C:\\check", SW_HIDE );
This displays the exe, It is not hiding this exe.
Can anybody clarify my doubt
[569 byte] By [
nithithika] at [2007-11-20 2:07:24]

# 1 Re: ShellExecute SW_HIDE option is not hiding the exe
Do you have the code to chekingexe.exe?
Just a guess that it may again be showing the window after the command line is processed.
# 2 Re: ShellExecute SW_HIDE option is not hiding the exe
ShellExecute( NULL, NULL, "Notepad.exe", NULL, NULL, SW_HIDE );
This is working fine
ShellExecute( NULL, "open","checkingexe.exe", NULL, "C:\\check", SW_HIDE );
This displays the exe, It is not hiding this exe.
Can anybody clarify my doubtMy guess: The app window is initially hidden, but receiving the DDE "open" command (that you are sending) makes it visible again.
# 3 Re: ShellExecute SW_HIDE option is not hiding the exe
Do you have the code to chekingexe.exe?
Just a guess that it may again be showing the window after the command line is processed.
checkingexe.exe is a simple dialogwindow. Just for testing purpose i created it. It is a simple MFCAPPwizard->dialog window
# 4 Re: ShellExecute SW_HIDE option is not hiding the exe
There is a line in the code telling it be visible again thats all,
while notepad doesnt have this explicit line.
# 5 Re: ShellExecute SW_HIDE option is not hiding the exe
There is a line in the code telling it be visible again thats all,
while notepad doesnt have this explicit line.
But i need to execute this exe without making it visible to user. Because during the Sevice start i have to invoke this exe.
Will there be any API's helpfulf to do this. I tried using CreateProcess but that is also again displaying the exe. It is not hiding it.
# 6 Re: ShellExecute SW_HIDE option is not hiding the exe
But i need to execute this exe without making it visible to user. Because during the Sevice start i have to invoke this exe.
Will there be any API's helpfulf to do this. I tried using CreateProcess but that is also again displaying the exe. It is not hiding it.Well, in this case, why are you creating a dialog for it at all? I mean, just create an application without any visible UI. A "dialog based" app is not suitable for this, since it displays a modal dialog.
# 7 Re: ShellExecute SW_HIDE option is not hiding the exe
But i need to execute this exe without making it visible to user. Because during the Sevice start i have to invoke this exe.
Will there be any API's helpfulf to do this. I tried using CreateProcess but that is also again displaying the exe. It is not hiding it.
The nShowCmd argument is passed on to the spawned applications entrypoint:
int WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow
);
Your application must used the value passed here to determine whether is should be visible or not.
- petter
# 8 Re: ShellExecute SW_HIDE option is not hiding the exe
BTW, it's not the exe that is shown or hidden, but the main window of the application. ;)
cilu at 2007-11-10 23:24:01 >

# 9 Re: ShellExecute SW_HIDE option is not hiding the exe
There is also a way to run a dialog app in hidden mode, and a flag that will keep a Icon from showing in the task bar.
ADSOFT at 2007-11-10 23:25:05 >

# 10 Re: ShellExecute SW_HIDE option is not hiding the exe
Thanks for everyone helping me in finding the correct solution