CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: close program

  1. #1
    Join Date
    Jan 2000
    Location
    sweden
    Posts
    22

    close program

    Hello somebody!!
    I´am new on this list so i dont know for sure how to do,but anyway..
    I wonder how to close another program example photoshop at seven a clock.
    peter



  2. #2
    Join Date
    Aug 1999
    Location
    US, Florida
    Posts
    817

    Re: close program

    Make a command1 and place this code into a form

    private Declare Function FindWindow Lib "user32" Alias _
    "FindWindowA" (byval lpClassName as string, _
    byval lpWindowName as string) as Long
    private Declare Function PostMessage Lib "user32" Alias _
    "PostMessageA" (byval hwnd as Long, byval wMsg as Long, _
    byval wParam as Long, lParam as Any) as Long

    private Sub Command1_Click()

    wHandle = FindWindow(vbNullString, "Adobe Photoshop")
    target = PostMessage(wHandle, &H10, 0&, 0&)
    If target = 0 then MsgBox "Closed"

    End Sub



    Good luck


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured