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 do I close another program from my program

How do I close another program from my program

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

    hi after i use ShellExecute() to run exe file i coudn't close it from my program by non of th function that i no like fileclose() so i need help to close exe file from my program :sigh:

    T C S 3 Replies Last reply
    0
    • S shortwave

      hi after i use ShellExecute() to run exe file i coudn't close it from my program by non of th function that i no like fileclose() so i need help to close exe file from my program :sigh:

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #2

      did you try CWnd::PostMessage(WM_CLOSE); ?


      TOXCCT >>> GEII power
      [toxcct][VisualCalc]

      T 1 Reply Last reply
      0
      • T toxcct

        did you try CWnd::PostMessage(WM_CLOSE); ?


        TOXCCT >>> GEII power
        [toxcct][VisualCalc]

        T Offline
        T Offline
        ThatsAlok
        wrote on last edited by
        #3

        toxcct wrote:

        did you try CWnd::PostMessage(WM_CLOSE); ?

        Humm... Nice .. But CWnd should be pointing to Other Window otherwise it will close it self! Better option will be ::PostMessage(WINDOW TO CLOSE HANDLE,WM_QUIT,...)

        "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

        cheers, Alok Gupta VC Forum Q&A :- I/ IV

        1 Reply Last reply
        0
        • S shortwave

          hi after i use ShellExecute() to run exe file i coudn't close it from my program by non of th function that i no like fileclose() so i need help to close exe file from my program :sigh:

          C Offline
          C Offline
          Cool Ju
          wrote on last edited by
          #4

          Hi, try createprocess and terminate process instead of ShellExecute. CreateProcess gives you the control over the created process. Bye, Cool Ju :cool: Dream Ur Destiny

          1 Reply Last reply
          0
          • S shortwave

            hi after i use ShellExecute() to run exe file i coudn't close it from my program by non of th function that i no like fileclose() so i need help to close exe file from my program :sigh:

            S Offline
            S Offline
            sanket patel
            wrote on last edited by
            #5

            you can try following CWnd *cwnd = FindWindow(NULL,"WINDOW_TO_FIND"); cwnd->PostMessage(WM_CLOSE,0,0); sanket patel

            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