I am in need of a complete compilable version of createProcess. I am trying to send the Process to a windows stat(0) handle to be seen on the desktop. I have not been able to find one working example. Thanks in advance for the help.
I am in need of a complete compilable version of createProcess. I am trying to send the Process to a windows stat(0) handle to be seen on the desktop. I have not been able to find one working example. Thanks in advance for the help.
Rephrase the question. I don't have the slightest idea of what you want.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
He wants a working Example of CreateProcess, actually being used and creating the process.Originally Posted by CornedBee
Throw this code into WinMain, and test (you'll have to change what I set hotkeyexe to, as im pretty sure thats not an executable on most person's systems), I've copied it straight out of one of my projects:
Code:char *hotkeyexe = "NameOfYourProgramHere.exe"; PROCESS_INFORMATION pi; STARTUPINFO si; CreateProcess(hotkeyexe, "", 0, 0, 0, 0, 0, 0, &si, &pi);
Well I don't even know how to really ask the right question because my dad understands it better than me. I think he is trying to make a program come up on his networked computer by creating a process and then moving it to the window Station(0) handle so the application can be seen on his desktop no matter what. He doesn't want it to run just behind the scenes.
Maybe you should have your Dad post here then, because I have no clue what you are attempting to do.
You need to rephrase this.creating a process and then moving it to the window Station(0) handle
Ok... i have no clue of what you are asking here but maybe just guessing u want the application visible and opened on the desktop (foreground).
Code:WinExec("C:\\Program Files\\MyApp.exe" , SW_SHOW);SW_FORCEMINIMIZE
Windows 2000/XP: Minimizes a window, even if the thread that owns the window is not responding. This flag should only be used when minimizing windows from a different thread.
SW_HIDE
Hides the window and activates another window.
SW_MAXIMIZE
Maximizes the specified window.
SW_MINIMIZE
Minimizes the specified window and activates the next top-level window in the Z order.
SW_RESTORE
Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when restoring a minimized window.
SW_SHOW
Activates the window and displays it in its current size and position.
SW_SHOWDEFAULT
Sets the show state based on the SW_ value specified in the STARTUPINFO structure passed to the CreateProcess function by the program that started the application.
SW_SHOWMAXIMIZED
Activates the window and displays it as a maximized window.
SW_SHOWMINIMIZED
Activates the window and displays it as a minimized window.
SW_SHOWMINNOACTIVE
Displays the window as a minimized window. This value is similar to SW_SHOWMINIMIZED, except the window is not activated.
SW_SHOWNA
Displays the window in its current size and position. This value is similar to SW_SHOW, except the window is not activated.
SW_SHOWNOACTIVATE
Displays a window in its most recent size and position. This value is similar to SW_SHOWNORMAL, except the window is not actived.
SW_SHOWNORMAL
Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when displaying the window for the first time.
try this and let me know if you are any close to what you want to do.
I think you may be asking how to launch an interactive program from a service. This is a massive security hole and for that reason will not be possible in future Windows versions. That being said, the code looks something like this:
See this page for more information.Code:STARTUPINFO si = { 0 }; PROCESS_INFORMATION pi = { 0 }; si.cb = sizeof(si); /* Use the interactive desktop rather than the current desktop. * WARNING: Security vulnerability! */ si.lpDesktop = TEXT("Winsta0\\Default"); CreateProcess(szProgramPath, szCommandLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); CloseHandle(pi.hThread); CloseHandle(pi.hProcess);
Last edited by anonytmouse; 01-17-2006 at 05:00 AM.