Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

VB - Close program

  • 15-01-2003 06: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, Registered Users 2 Posts: 629 ✭✭✭str8_away


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


Advertisement