0
#include <windows.h>
#include <shellapi.h>

int main(int argc, char* argv[])
{
	ShellExecute(NULL,"open","C:/Windows/System32/calc.exe",NULL,"C:/Windows/System32/",SW_HIDE);
	Sleep(1000);
	ShowWindow(FindWindow(NULL, "Calculator"), SW_HIDE);
	return 0;
}

ok well if i dont have the sleep(1000); there it doesnt hide the window.
i want it to load the window hidden, not hide it once its loaded.

Does anyone have any suggestions.

Note: I have also tried CreateProcess() with the startup params.

3
Contributors
6
Replies
7
Views
9 Years
Discussion Span
Last Post by FTProtocol
0

Does anyone have any suggestions.

Whether or not a given application starts up as hidden depends on how the application is coded. I.e. it may be that calc, for example, ensures that it starts up with a visible window.

0

i know hiding firefox/internet explorer on startup (ie it doesnt show at all) is possible in VB but why doesn't it work for c++?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.