Hide the cmd window using createprocess function
-
I want to Hide the my command window using createprocess i m using this like but not able to hide PROCESS_INFORMATION pInfo; STARTUPINFOA sInfo; DWORD exitCode; sInfo.cb = sizeof(STARTUPINFOA); sInfo.lpReserved = NULL; sInfo.lpReserved2 = NULL; sInfo.cbReserved2 = 0; sInfo.lpDesktop = NULL; sInfo.lpTitle = NULL; sInfo.dwFlags = 0; sInfo.dwX = 0; sInfo.dwY = 0; sInfo.dwFillAttribute = 0; sInfo.wShowWindow = SW_HIDE; memset (&sInfo, 0, sizeof(sInfo)); sInfo.cb = sizeof(sInfo); bool type = CreateProcess(NULL, cmdpath, NULL, NULL, FALSE, 0, NULL, NULL, &sInfo, &pInfo);
-
I want to Hide the my command window using createprocess i m using this like but not able to hide PROCESS_INFORMATION pInfo; STARTUPINFOA sInfo; DWORD exitCode; sInfo.cb = sizeof(STARTUPINFOA); sInfo.lpReserved = NULL; sInfo.lpReserved2 = NULL; sInfo.cbReserved2 = 0; sInfo.lpDesktop = NULL; sInfo.lpTitle = NULL; sInfo.dwFlags = 0; sInfo.dwX = 0; sInfo.dwY = 0; sInfo.dwFillAttribute = 0; sInfo.wShowWindow = SW_HIDE; memset (&sInfo, 0, sizeof(sInfo)); sInfo.cb = sizeof(sInfo); bool type = CreateProcess(NULL, cmdpath, NULL, NULL, FALSE, 0, NULL, NULL, &sInfo, &pInfo);
-
I want to Hide the my command window using createprocess i m using this like but not able to hide PROCESS_INFORMATION pInfo; STARTUPINFOA sInfo; DWORD exitCode; sInfo.cb = sizeof(STARTUPINFOA); sInfo.lpReserved = NULL; sInfo.lpReserved2 = NULL; sInfo.cbReserved2 = 0; sInfo.lpDesktop = NULL; sInfo.lpTitle = NULL; sInfo.dwFlags = 0; sInfo.dwX = 0; sInfo.dwY = 0; sInfo.dwFillAttribute = 0; sInfo.wShowWindow = SW_HIDE; memset (&sInfo, 0, sizeof(sInfo)); sInfo.cb = sizeof(sInfo); bool type = CreateProcess(NULL, cmdpath, NULL, NULL, FALSE, 0, NULL, NULL, &sInfo, &pInfo);
Is this your command window or cmd if its cmd you can use of cmd/h.
Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )
-
Is this your command window or cmd if its cmd you can use of cmd/h.
Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )
-
It is not cmd window this is my copymovie.exe which i run through createprocess in my mfc application
Of course you have a way you can use of FindWindow for get hwnd to your window and then use of **::**ShowWindow(hwnd,SW_HIDE);
Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )
-
I want to Hide the my command window using createprocess i m using this like but not able to hide PROCESS_INFORMATION pInfo; STARTUPINFOA sInfo; DWORD exitCode; sInfo.cb = sizeof(STARTUPINFOA); sInfo.lpReserved = NULL; sInfo.lpReserved2 = NULL; sInfo.cbReserved2 = 0; sInfo.lpDesktop = NULL; sInfo.lpTitle = NULL; sInfo.dwFlags = 0; sInfo.dwX = 0; sInfo.dwY = 0; sInfo.dwFillAttribute = 0; sInfo.wShowWindow = SW_HIDE; memset (&sInfo, 0, sizeof(sInfo)); sInfo.cb = sizeof(sInfo); bool type = CreateProcess(NULL, cmdpath, NULL, NULL, FALSE, 0, NULL, NULL, &sInfo, &pInfo);
-
now i remove //memset (&sInfo, 0, sizeof(sInfo)); // sInfo.cb = sizeof(sInfo); but it is not also work........
-
I want to Hide the my command window using createprocess i m using this like but not able to hide PROCESS_INFORMATION pInfo; STARTUPINFOA sInfo; DWORD exitCode; sInfo.cb = sizeof(STARTUPINFOA); sInfo.lpReserved = NULL; sInfo.lpReserved2 = NULL; sInfo.cbReserved2 = 0; sInfo.lpDesktop = NULL; sInfo.lpTitle = NULL; sInfo.dwFlags = 0; sInfo.dwX = 0; sInfo.dwY = 0; sInfo.dwFillAttribute = 0; sInfo.wShowWindow = SW_HIDE; memset (&sInfo, 0, sizeof(sInfo)); sInfo.cb = sizeof(sInfo); bool type = CreateProcess(NULL, cmdpath, NULL, NULL, FALSE, 0, NULL, NULL, &sInfo, &pInfo);
Your problem is in the Flags: sInfo.dwFlags = STARTF_USESHOWWINDOW;
PROCESS\_INFORMATION pInfo; STARTUPINFOA sInfo; sInfo.cb = sizeof(STARTUPINFOA); sInfo.lpReserved = NULL; sInfo.lpReserved2 = NULL; sInfo.cbReserved2 = 0; sInfo.lpDesktop = NULL; sInfo.lpTitle = NULL; sInfo.dwFlags = STARTF\_USESHOWWINDOW; sInfo.dwX = 0; sInfo.dwY = 0; sInfo.dwFillAttribute = 0; sInfo.wShowWindow = SW\_HIDE; BOOL ret = ::CreateProcess(m\_PathToExe, lpExePlusArgs, NULL, NULL, FALSE, 0, NULL, NULL, &sInfo, &pInfo); if(ret) { // Wait until application has terminated WaitForSingleObject(pInfo.hProcess, INFINITE); // Close process and thread handles ::CloseHandle(pInfo.hThread); ::CloseHandle(pInfo.hProcess); }
Read MSDN carefully and with patience.
kostas KEL