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. problem using ShellExecute to open folder

problem using ShellExecute to open folder

Scheduled Pinned Locked Moved C / C++ / MFC
help
4 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.
  • R Offline
    R Offline
    Rahul Vaishnav
    wrote on last edited by
    #1

    Hi all, I have faced an amazing problem. Please go through below steps to reproduce: 1. create two folders ex. new1 & new2 on D drive. 2. create one short cut of folder new1 like "Shortcut to new1" on D drive only. 3. Rename "Shortcut to new1" to "new2" 4. Execute below code

    ShellExecute(GetSafeHwnd(), NULL, L"D:\\new2", L"", NULL,
    SW_SHOWNORMAL);

    Actual Results : It opens folder new1 from D drive. Expected results : It should open folder new2 D drive.

    enhzflepE S 2 Replies Last reply
    0
    • R Rahul Vaishnav

      Hi all, I have faced an amazing problem. Please go through below steps to reproduce: 1. create two folders ex. new1 & new2 on D drive. 2. create one short cut of folder new1 like "Shortcut to new1" on D drive only. 3. Rename "Shortcut to new1" to "new2" 4. Execute below code

      ShellExecute(GetSafeHwnd(), NULL, L"D:\\new2", L"", NULL,
      SW_SHOWNORMAL);

      Actual Results : It opens folder new1 from D drive. Expected results : It should open folder new2 D drive.

      enhzflepE Offline
      enhzflepE Offline
      enhzflep
      wrote on last edited by
      #2

      Howdy. It's a very simple fix. The outcome kinda makes sense too, to me. Anyhoo, just try this instead -

      ShellExecute(HWND_DESKTOP, NULL, L"C:\\new2\\", L"", NULL, SW_SHOWNORMAL);

      :)

      R 1 Reply Last reply
      0
      • enhzflepE enhzflep

        Howdy. It's a very simple fix. The outcome kinda makes sense too, to me. Anyhoo, just try this instead -

        ShellExecute(HWND_DESKTOP, NULL, L"C:\\new2\\", L"", NULL, SW_SHOWNORMAL);

        :)

        R Offline
        R Offline
        Rahul Vaishnav
        wrote on last edited by
        #3

        Thanks for you reply...

        1 Reply Last reply
        0
        • R Rahul Vaishnav

          Hi all, I have faced an amazing problem. Please go through below steps to reproduce: 1. create two folders ex. new1 & new2 on D drive. 2. create one short cut of folder new1 like "Shortcut to new1" on D drive only. 3. Rename "Shortcut to new1" to "new2" 4. Execute below code

          ShellExecute(GetSafeHwnd(), NULL, L"D:\\new2", L"", NULL,
          SW_SHOWNORMAL);

          Actual Results : It opens folder new1 from D drive. Expected results : It should open folder new2 D drive.

          S Offline
          S Offline
          Shivanand Gupta
          wrote on last edited by
          #4

          you rename shortcut name , it dose not matter. because if you change the shortcut name but it still target old one. so you want to change target then you do right click on shortcut --> select property -> change target path

          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