Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CreateProcess() method

CreateProcess() method

Scheduled Pinned Locked Moved C / C++ / MFC
questiondatabase
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Madan Chauhan
    wrote on last edited by
    #1

    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.

    N J 2 Replies Last reply
    0
    • M Madan Chauhan

      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.

      N Offline
      N Offline
      Nibu babu thomas
      wrote on last edited by
      #2

      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 called perfmon.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 use ShellExecuteEx 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

      1 Reply Last reply
      0
      • M Madan Chauhan

        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.

        J Offline
        J Offline
        Jijo Raj
        wrote on last edited by
        #3

        mmc.exe (Microsoft Management Console) is the host executable that actually runs when you open diskmgmt.msc. So spawn mmc.exe by using CreateProcess(). 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.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups