CreateProcess() method
-
Hi all, I have one query. I am able to run any .exe using createProcess() by giving the complete path of exe as first parameter. If I want to run diskmgmt.msc then I click on Start->run-> "type here diskmgmt.msc". Now I want to execute this disk management by using createprocess method. Please suggest me that how can I do this? Thanks.
-
Hi all, I have one query. I am able to run any .exe using createProcess() by giving the complete path of exe as first parameter. If I want to run diskmgmt.msc then I click on Start->run-> "type here diskmgmt.msc". Now I want to execute this disk management by using createprocess method. Please suggest me that how can I do this? Thanks.
Madan Chauhan wrote:
If I want to run diskmgmt.msc then I click on Start->run-> "type here diskmgmt.msc". Now I want to execute this disk management by using createprocess method.
The process for running msc files is
C:\WINDOWS\system32\mmc.exe
. So for e.g. you wanna run an msc file calledperfmon.msc
then you've got to pass it on as a command line argument... C:\WINDOWS\system32\mmc.exe perfmon.msc So for disk management msc file we'll go like this... C:\WINDOWS\system32\mmc.exe diskmgmt.msc Another option is to useShellExecuteEx
without worrying about which exe should be used for opening a file. The Shell will decide. ;) But limitations being that you cannot wait on the process handle.Nibu babu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com
-
Hi all, I have one query. I am able to run any .exe using createProcess() by giving the complete path of exe as first parameter. If I want to run diskmgmt.msc then I click on Start->run-> "type here diskmgmt.msc". Now I want to execute this disk management by using createprocess method. Please suggest me that how can I do this? Thanks.
mmc.exe
(Microsoft Management Console) is the host executable that actually runs when you opendiskmgmt.msc
. So spawnmmc.exe
by usingCreateProcess()
. For instance,// Startup Info.
STARTUPINFO si;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);// Process Info.
PROCESS_INFORMATION pi;
ZeroMemory( &pi, sizeof(pi) );// Start the child process.
CreateProcess( NULL,
_T("mmc.exe diskmgmt.msc"),
NULL,
NULL,
FALSE,
0,
NULL,
NULL,
&si,
&pi );Well, If you just want to open the DiskManagementConsole, then
ShellExecute()
can do it more easily.ShellExecute( 0, _T("open"), _T("diskmgmt.msc"), 0, 0, SW_SHOW );
Regards, Jijo.
_____________________________________________________ http://weseetips.com[^] Visual C++ tips and tricks. Updated daily.