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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. ShellExecute problem

ShellExecute problem

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
5 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.
  • N Offline
    N Offline
    nss
    wrote on last edited by
    #1

    I finally settled on this but am still uneasy.

    HINSTANCE res = ShellExecute(NULL,"Open", helpFile, "","E:\\\\", SW\_SHOWNORMAL);	
    
    int r = (int)res;
    
    if(r <=32)ShellExecute(NULL,"Open", helpFile, "","C:\\\\", SW\_SHOWNORMAL);
    

    I imagine all I need in the 5th paramtere is the drive letter where the explorer exe is stored. My assumption that its either in E or C is dangerous. How should I handle this dilemma? Thanks, ns

    B 1 Reply Last reply
    0
    • N nss

      I finally settled on this but am still uneasy.

      HINSTANCE res = ShellExecute(NULL,"Open", helpFile, "","E:\\\\", SW\_SHOWNORMAL);	
      
      int r = (int)res;
      
      if(r <=32)ShellExecute(NULL,"Open", helpFile, "","C:\\\\", SW\_SHOWNORMAL);
      

      I imagine all I need in the 5th paramtere is the drive letter where the explorer exe is stored. My assumption that its either in E or C is dangerous. How should I handle this dilemma? Thanks, ns

      B Offline
      B Offline
      BaldwinMartin
      wrote on last edited by
      #2

      SHELLEXECUTEINFO sei; ZeroMemory(&sei, sizeof(SHELLEXECUTEINFO)); sei.cbSize = sizeof (SHELLEXECUTEINFO); sei.lpVerb = NULL; sei.lpFile = m_strYourEXEFile; sei.nShow = SW_SHOW; sei.hInstApp = NULL; sei.lpDirectory = NULL; sei.fMask = SEE_MASK_DOENVSUBST|SEE_MASK_NOCLOSEPROCESS; sei.lpParameters = NULL; if (ShellExecuteEx (&sei) ) return TRUE; else return FALSE; } Best Wishes and Happy Holiday's, ez_way

      N 1 Reply Last reply
      0
      • B BaldwinMartin

        SHELLEXECUTEINFO sei; ZeroMemory(&sei, sizeof(SHELLEXECUTEINFO)); sei.cbSize = sizeof (SHELLEXECUTEINFO); sei.lpVerb = NULL; sei.lpFile = m_strYourEXEFile; sei.nShow = SW_SHOW; sei.hInstApp = NULL; sei.lpDirectory = NULL; sei.fMask = SEE_MASK_DOENVSUBST|SEE_MASK_NOCLOSEPROCESS; sei.lpParameters = NULL; if (ShellExecuteEx (&sei) ) return TRUE; else return FALSE; } Best Wishes and Happy Holiday's, ez_way

        N Offline
        N Offline
        nss
        wrote on last edited by
        #3

        I think I didnt explain right: I want the .htm file to open up in explorer. Its not an exe file. Thanks, ns

        M B 2 Replies Last reply
        0
        • N nss

          I think I didnt explain right: I want the .htm file to open up in explorer. Its not an exe file. Thanks, ns

          M Offline
          M Offline
          Michael Dunn
          wrote on last edited by
          #4

          Just pass NULL for the starting directory, that is unimportant when you're running IE to show a web page --Mike-- Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber If my rhyme was a drug, I'd sell it by the gram.

          1 Reply Last reply
          0
          • N nss

            I think I didnt explain right: I want the .htm file to open up in explorer. Its not an exe file. Thanks, ns

            B Offline
            B Offline
            BaldwinMartin
            wrote on last edited by
            #5

            sorry my mistake. Best Wishes and Happy Holiday's, ez_way

            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