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 to close a file opened using ShellExecute

How to close a file opened using ShellExecute

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

    Hi, I am woking with a dialog based application.On click of a button I opened a text file using ShellExecute(NULL, "C:\\Text.txt", szPath, NULL, NULL, SW_MAXIMIZE ); On clicking another button I should be able to close this file. Can anyone please help with some function that automatically closes a file when passed the file path to it. Thanks

    D 1 Reply Last reply
    0
    • L ledallam

      Hi, I am woking with a dialog based application.On click of a button I opened a text file using ShellExecute(NULL, "C:\\Text.txt", szPath, NULL, NULL, SW_MAXIMIZE ); On clicking another button I should be able to close this file. Can anyone please help with some function that automatically closes a file when passed the file path to it. Thanks

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Send that window (e.g., Notepad) a WM_CLOSE message.


      "Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

      "There is no death, only a change of worlds." - Native American Proverb

      J 1 Reply Last reply
      0
      • D David Crow

        Send that window (e.g., Notepad) a WM_CLOSE message.


        "Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

        "There is no death, only a change of worlds." - Native American Proverb

        J Offline
        J Offline
        jayart
        wrote on last edited by
        #3

        Interesting..question and a more interesting answer...But how to get the window handle for the opened file using shellexecute?

        D 1 Reply Last reply
        0
        • J jayart

          Interesting..question and a more interesting answer...But how to get the window handle for the opened file using shellexecute?

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          ArtiGujare wrote:

          But how to get the window handle for the opened file using shellexecute?

          First you'll need to use ShellExecuteEx(). Then, see here.


          "Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

          "There is no death, only a change of worlds." - Native American Proverb

          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