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. How get the path of Internet Explorer (executable) or any APP.EXE ??

How get the path of Internet Explorer (executable) or any APP.EXE ??

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

    How could I get the path of a APP.EXE ?? I need to open a Site with Internet Explorer browser. I have used the GetModuleFileName function, but I don't have the HMODULE parameter (to get HMODULE, the GetModuleHandle function also doesn't work). Any idea ?? Thanks, Cris.

    A B 2 Replies Last reply
    0
    • C Cris

      How could I get the path of a APP.EXE ?? I need to open a Site with Internet Explorer browser. I have used the GetModuleFileName function, but I don't have the HMODULE parameter (to get HMODULE, the GetModuleHandle function also doesn't work). Any idea ?? Thanks, Cris.

      A Offline
      A Offline
      Amit Dey
      wrote on last edited by
      #2

      GetModuleHandle(NULL); ?

      Hush,hush... thought I heard you call my name now. Kula Shaker. Amit Dey Latest articles at CP -
      PocketPC New menu Office addin

      1 Reply Last reply
      0
      • C Cris

        How could I get the path of a APP.EXE ?? I need to open a Site with Internet Explorer browser. I have used the GetModuleFileName function, but I don't have the HMODULE parameter (to get HMODULE, the GetModuleHandle function also doesn't work). Any idea ?? Thanks, Cris.

        B Offline
        B Offline
        Big Art
        wrote on last edited by
        #3

        Hello There! If the app was put on your computer with an installer you don't need the path because it is registered in the registery automatically. You can just provide the name of the executable in ShellExecute(..) and it will launch the app. However if you insist on getting the path use this: char szRegBuf[200]; DWORD pcbData=199; if(!::SHGetValue(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\TheExecutable.exe","Path",(LPDWORD)REG_NONE,szRegBuf,&pcbData)) { AfxMessageBox("Successfuly located TheExecutable.exe path in the registry"); }

        C 1 Reply Last reply
        0
        • B Big Art

          Hello There! If the app was put on your computer with an installer you don't need the path because it is registered in the registery automatically. You can just provide the name of the executable in ShellExecute(..) and it will launch the app. However if you insist on getting the path use this: char szRegBuf[200]; DWORD pcbData=199; if(!::SHGetValue(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\TheExecutable.exe","Path",(LPDWORD)REG_NONE,szRegBuf,&pcbData)) { AfxMessageBox("Successfuly located TheExecutable.exe path in the registry"); }

          C Offline
          C Offline
          Cris
          wrote on last edited by
          #4

          Ok, and abount the SHGetValue function ?? Where it is declared ?? []'s

          B 1 Reply Last reply
          0
          • C Cris

            Ok, and abount the SHGetValue function ?? Where it is declared ?? []'s

            B Offline
            B Offline
            Big Art
            wrote on last edited by
            #5

            Hi Cris, It is declared in Shlwapi.h. Or you can use some other Registry access function if you want. I have the MSDN info for you if you wish. But once again you really don't need the path if you use ShellExecute(..) on an installed application. Art /////////////// From MSDN info /////////////// SHGetValue Retrieves a registry value. DWORD SHGetValue( HKEY hkey, LPCTSTR pszSubKey, LPCTSTR pszValue, LPDWORD pdwType, LPVOID pvData, LPDWORD pcbData ); Parameters hkey Handle to the currently open key, or any of the following predefined values: HKEY_CLASSES_ROOT HKEY_CURRENT_CONFIG HKEY_CURRENT_USER HKEY_DYN_DATA (Windows 95 only) HKEY_LOCAL_MACHINE HKEY_PERFORMANCE_DATA (Windows NT only) HKEY_USERS pszSubKey Address of a null-terminated string that specifies the name of the subkey from which to retrieve the value. pszValue Address of the value. pdwType Type of value. For more information, see Registry Data Types. pvData Address of the destination data buffer. pcbData Size of the destination data buffer. Return Values Returns ERROR_SUCCESS if successful, or a nonzero error code defined in Winerror.h otherwise. You can use the FormatMessage function with the FORMAT_MESSAGE_FROM_SYSTEM flag to retrieve a generic description of the error. Remarks Note If your application must set/retrieve a series of values in the same key, it is better to open the key once and set/retrieve the values with the regular Microsoft® Win32® registry functions rather than use this function repeatedly. Requirements Version 4.71 and later of Shlwapi.dll Windows NT/2000: Requires Windows 2000 (or Windows NT 4.0 with Internet Explorer 4.0 or later). Windows 95/98/Me: Requires Windows 98 (or Windows 95 with Internet Explorer 4.0 or later). Header: Declared in Shlwapi.h. Import Library: Shlwapi.lib.

            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