How to get ShellExecute () in vc++/c++

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • visweswaran2830
    New Member
    • Nov 2009
    • 92

    How to get ShellExecute () in vc++/c++

    Hi,

    I am developing an application using vc++, in that, i have to execute shell command. I executed successfully using ShellExecute(). Now i want to know how to get the return value of that shell command, while executing mountvol like this command, it return list of drives, if I run using the above method, how can i get that return value.. can any one help me
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    You can't get any return data using ShellExecute to execute a command. It is a fire and forget type of launch.

    What you could do is call CreateProcess to run your command and then you could intercept stdin, stdout, stderr and pipe the input/output of thoser streams back to you program to interpret the data.

    However a far better idea would be to just call 1 or more of the volume management functions that are part of the WIN32 API.

    Comment

    • visweswaran2830
      New Member
      • Nov 2009
      • 92

      #3
      Thank you for your response, could you explain in details if possible with some code snippets....

      Comment

      • Banfa
        Recognized Expert Expert
        • Feb 2006
        • 9067

        #4
        If you read the help pages at the end of the link I posted you will find example code and explainations of how to use the API.

        Personally I have never used that part of the API so the best I could do is read those pages and re-iterate them to you but, frankly, I am a little too busy to be doing the reading you should be doing for yourself.

        Comment

        Working...