i created a windows service 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
here's my code:
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 know why its works for one program and not the other..Code: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); } }




Reply With Quote
