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. Visual Basic
  4. Close a running exe

Close a running exe

Scheduled Pinned Locked Moved Visual Basic
tutorial
4 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
    Birdy
    wrote on last edited by
    #1

    Hi Friendz! Do any one know how to close a running exe in vb 6.0 PLz tell me as early as possible. Work Hard and Test your Luck

    R N O 3 Replies Last reply
    0
    • B Birdy

      Hi Friendz! Do any one know how to close a running exe in vb 6.0 PLz tell me as early as possible. Work Hard and Test your Luck

      R Offline
      R Offline
      Ray Cassick
      wrote on last edited by
      #2

      Try this: http://www.vbsquare.com/api/tip233.html[^]

      1 Reply Last reply
      0
      • B Birdy

        Hi Friendz! Do any one know how to close a running exe in vb 6.0 PLz tell me as early as possible. Work Hard and Test your Luck

        N Offline
        N Offline
        Nick Parker
        wrote on last edited by
        #3

        Looks like Ray's solution should work, the basic idea is that you will need the handle to the window you want to close. Once you have the handle to the window you will then send a message to the message queue passing it the WM_CLOSE message to close that Window. So all you need is something like this: Define these in a module:

        Public Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hWnd As Long, ByVal _
        Msg As Long, wParam As Any, lParam As Any) As Long
        Public Const WM_CLOSE = &H10

        Your code:

        Dim hWnd As Long
        'You will want the handle to the window you want to close
        'however this is just an example with the handle to the
        'current window. 
        hWnd = Me.hWnd
        result = SendMessage(hWnd, WM\_CLOSE, ByVal CLng(0), ByVal CLng(0))
        

        HTH Nick Parker


        1 Reply Last reply
        0
        • B Birdy

          Hi Friendz! Do any one know how to close a running exe in vb 6.0 PLz tell me as early as possible. Work Hard and Test your Luck

          O Offline
          O Offline
          Oberdan Borges Nunes
          wrote on last edited by
          #4

          See Api PostMessage Oberdan

          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