how to run a gui program in the background?

Apr 22, 2013 at 12:43pm
i'm trying to create a program that will run another program. but the program i want to run has a gui and i don't want the gui to be visible, i just want the program to run in the background.

But i have to do it without editing the gui program. I do not have access to the code

here's my code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
        TCHAR* path = L"C:\\Myfile\\test.exe";
	STARTUPINFO info = {0};
	PROCESS_INFORMATION processInfo;

	ZeroMemory( &info, sizeof(info) );
	info.cb = sizeof(info);
	ZeroMemory( &processInfo, sizeof(processInfo) );

	info.dwFlags = STARTF_USESHOWWINDOW;
	info.wShowWindow = FALSE; 

	if (CreateProcess(path, NULL, NULL, NULL, TRUE, 0, NULL, NULL, &info, &processInfo))
	{
		::WaitForSingleObject(processInfo.hProcess, INFINITE);
		CloseHandle(processInfo.hProcess);
		CloseHandle(processInfo.hThread);
	}
    }


i tested this code with notepad and it runs notepad in the background without displaying the window but when i try run my program it doesn't work

i don't have access to the GUI programs code
Last edited on Apr 22, 2013 at 3:01pm
Apr 22, 2013 at 1:32pm
the program i want to run has a gui and i don't want the gui to be visible, i just want the program to run in the background.

Does the program require input? Can you send it the input by any other means than GUI?
Apr 22, 2013 at 1:54pm
yes the program requires input. i didn't make the program i am just trying to run it in the background so i can't change anything
Apr 22, 2013 at 5:07pm
If the program requires input and GUI is the only input method, then you have to use the GUI.
Apr 29, 2013 at 8:33am
@keskiverto yes the GUI will be used but it will be used by another computer. I am trying to run this GUI program as a service, then another computer will access this GUI
Topic archived. No new replies allowed.