Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

VB - Close program

Options
  • 15-01-2003 7:54pm
    #1
    Closed Accounts Posts: 219 ✭✭


    Visual Basic 6

    hi was just wondering if anyone can give me some advice
    i am trying to write a progam so that when i click a button it will close kazaa down but the thing is that when i click the button it just goes down into the system-tray. if i use the code for notepad or something it closes it stright away. so i guess the question is how to i close stuff from the system-tray.

    code below:

    'find the app
    Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
    (ByVal lpClassName As String, _
    ByVal lpWindowName As String) _
    As Long

    'send the app a close message

    Declare Function SendMessage _
    Lib "user32" Alias "SendMessageA" _
    (ByVal hwnd As Long, _
    ByVal wMsg As Long, _
    ByVal wParam As Long, _
    lParam As Long) _
    As Long


    Private Sub Command1_Click()
    Dim Handle As Long
    Const NILL = 0&
    Const WM_SYSCOMMAND = &H112
    Const SC_CLOSE = &HF060&



    Handle = FindWindow("kazaa", vbNullString)


    Handle = SendMessage(Handle, WM_SYSCOMMAND, SC_CLOSE, NILL)

    End Sub


Comments

  • Registered Users Posts: 629 ✭✭✭str8_away


    Does Kasaa has an option that says "close to system tray"?
    I know some programs have that option.


Advertisement