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. ShellExecute()

ShellExecute()

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
6 Posts 4 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.
  • B Offline
    B Offline
    briefcase
    wrote on last edited by
    #1

    I'm sorry for the generalization, but I need help using the ShellExecute() function (to launch a .hlp file). ShellExecute( ?, "open", "Helpfile.hlp", NULL, ?, //dir SW_SHOW ); I put a '?' where I don't know what I should put :) The first is the window handle thingy, I really don't want the opened file attached to anything, how do i do this? The second ? is the directory... I have no idea what to set this too. If it's the programs current dir, how do i find that? Thanks

    R D S 3 Replies Last reply
    0
    • B briefcase

      I'm sorry for the generalization, but I need help using the ShellExecute() function (to launch a .hlp file). ShellExecute( ?, "open", "Helpfile.hlp", NULL, ?, //dir SW_SHOW ); I put a '?' where I don't know what I should put :) The first is the window handle thingy, I really don't want the opened file attached to anything, how do i do this? The second ? is the directory... I have no idea what to set this too. If it's the programs current dir, how do i find that? Thanks

      R Offline
      R Offline
      Rickard Andersson20
      wrote on last edited by
      #2

      briefcase wrote: The first is the window handle thingy, I really don't want the opened file attached to anything, how do i do this? Simply put NULL there! It works just fine! briefcase wrote: The second ? is the directory... I have no idea what to set this too. If it's the programs current dir, how do i find that? Simply put NULL there too! Those aren't necessary when you do such a thing that you do! :) Rickard Andersson@Suza Computing C# and C++ programmer from SWEDEN! UIN: 50302279 E-Mail: nikado@pc.nu Speciality: I love C#, ASP.NET and C++!

      B 1 Reply Last reply
      0
      • B briefcase

        I'm sorry for the generalization, but I need help using the ShellExecute() function (to launch a .hlp file). ShellExecute( ?, "open", "Helpfile.hlp", NULL, ?, //dir SW_SHOW ); I put a '?' where I don't know what I should put :) The first is the window handle thingy, I really don't want the opened file attached to anything, how do i do this? The second ? is the directory... I have no idea what to set this too. If it's the programs current dir, how do i find that? Thanks

        D Offline
        D Offline
        DanielP
        wrote on last edited by
        #3

        Set NULL. To know current dir - invoke GetModuleFileName()

        1 Reply Last reply
        0
        • R Rickard Andersson20

          briefcase wrote: The first is the window handle thingy, I really don't want the opened file attached to anything, how do i do this? Simply put NULL there! It works just fine! briefcase wrote: The second ? is the directory... I have no idea what to set this too. If it's the programs current dir, how do i find that? Simply put NULL there too! Those aren't necessary when you do such a thing that you do! :) Rickard Andersson@Suza Computing C# and C++ programmer from SWEDEN! UIN: 50302279 E-Mail: nikado@pc.nu Speciality: I love C#, ASP.NET and C++!

          B Offline
          B Offline
          briefcase
          wrote on last edited by
          #4

          hmm... alright, what am i doing wrong? ShellExecute( NULL, "open", "myhelp.hlp", NULL, NULL, //dir SW_SHOW ); myhelp.hlp exists in the same dir as the calling program.

          D 1 Reply Last reply
          0
          • B briefcase

            hmm... alright, what am i doing wrong? ShellExecute( NULL, "open", "myhelp.hlp", NULL, NULL, //dir SW_SHOW ); myhelp.hlp exists in the same dir as the calling program.

            D Offline
            D Offline
            DanielP
            wrote on last edited by
            #5

            that's right code. And what is happend then? (Note that lpVerb can be setted to NULL too )

            1 Reply Last reply
            0
            • B briefcase

              I'm sorry for the generalization, but I need help using the ShellExecute() function (to launch a .hlp file). ShellExecute( ?, "open", "Helpfile.hlp", NULL, ?, //dir SW_SHOW ); I put a '?' where I don't know what I should put :) The first is the window handle thingy, I really don't want the opened file attached to anything, how do i do this? The second ? is the directory... I have no idea what to set this too. If it's the programs current dir, how do i find that? Thanks

              S Offline
              S Offline
              Stuart Dootson
              wrote on last edited by
              #6

              HWND(0) for the first argument - then any windows are parented by the desktop NULL is usually fine for the directory parameter - it's the 'default directory' (i.e. if you were at the command prompt, it's what would be listed if you did 'dir .'), which is usually not needed if you've specified an absolute path (i.e. drive:\path...\filename.extension or \\server\path...\filename.extension for the file parameter). To get the current directory (if you need to), use the GetCurrentDirectory Win32 function. Stuart Dootson 'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'

              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