Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

VB - Close program

  • 15-01-2003 07: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