Announcement

Collapse
No announcement yet.

What is the meaning of the return value of shell execute

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • What is the meaning of the return value of shell execute

    Hi, I have a installation project, before installing my application, I need to install a VC redistribution. Sometimes the Shell.Execute returns 23, sometimes it returns 1638. I think only a return value of 0 means that it runs correctly. So I try to get the last error ,but the Application.GetLastError always return 0,Could you tell me how to find the means of the return value of the Shell.Execute.Or why the Shell.Execute does not return 0?



  • #2
    result = Shell.Execute("Framework\\vc_redist.x64.exe", "open", szInstall, "", "SW_SHOWNORMAL", true);
    lastError = Application.GetLastError();
    Debug.Print("result: "..result.." last error "..lastError.." \r\n");
    if ( lastError == 0 ) then
    if ( result == 0 ) then
    -- success
    VCinstalled = true;
    elseif ( result == 1602 ) then
    -- cancel
    elseif ( result == 1511 ) or ( result == 1641 ) or ( result == 3010 ) then
    -- success restart
    VCinstalled = true;
    bReboot = true;
    else
    -- error
    end
    end

    Comment


    • #3
      Do I need to consider the return value of Shell.Execute ? Or if the Application.GetLastError returns a value of 0, then it means everything is OK?

      Comment


      • #4
        You need to check the return value. The Application.GetLastError() would be used only if the WaitForReturn was set to false.

        Ulrich

        Comment


        • #5
          I wouldn't have been quite that generous, Ulrich - an RTM response might have been more fitting here. Look in your manual, ChrisChen. Directly linked from the Action Wizard under Shell.Execute:




          ... and ditto for the meaning of the Error Codes. Type 'error codes' into your manual's index:

          Comment

          Working...
          X