Traytip iwe einen Button benutzen? (wenn man draufklickt fenster @sw_show)

  • Ich habe einen Traytip ich möchte das wenn man drauf klickt ein fenster angezeigt wird.
    bekomme aber immer nur 1 zurück dafür das der tray tip angezeigt wird. aber nciht ob drauf geklickt wurde

    Warscheinlich hab ich einfach nur ein brett vorm Kopf ;)
    so gehts sowieso nicht aber wie gehts ? ?(:)

    Spoiler anzeigen
    [autoit]

    $tray = TrayTip("Neue Nachricht",$receivedData,0,1)
    if $tray = ? then Guisetstate(@SW_SHOW)

    [/autoit]


    ich hoffe ihr könnt mir helfen
    :thumbup:
    mfg buphx

  • jetzt gibt es ein neues problem: ohne die raufklick function werden die eingehenden daten in das edtit fenster geschreiben

    Spoiler anzeigen
    [autoit]

    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_outfile_type=a3x
    #AutoIt3Wrapper_outfile=G:\Client.a3x
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    #include <array.au3>
    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    ;##### Tray #####
    Opt("TrayOnEventMode", 1)
    Opt("TrayMenuMode", 1 + 2)
    $ausblenden = TrayCreateItem("Ausblenden")
    TrayItemSetOnEvent($ausblenden, "_hide")
    $einblenden = TrayCreateItem("Einblenden")
    TrayItemSetOnEvent($einblenden, "_show")
    $exititem = TrayCreateItem("Exit")
    TrayItemSetOnEvent($exititem, "_Exit")

    [/autoit] [autoit][/autoit] [autoit]

    ;#### #Gui #####
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Client", 479, 537, 0, 0, $ws_popup)
    GUISetBkColor(0xD5E2EA)
    $Pic1 = GUICtrlCreatePic(@ScriptDir & "AFS.jpeg", 35, 20, 408, 74)
    $Input1 = GUICtrlCreateInput("Hallo ;)", 24, 116, 313, 21)
    GUICtrlSetBkColor($Input1, 0xD5E2ff)
    $Button1 = GUICtrlCreateButton("Senden", 352, 116, 97, 22)
    GUICtrlSetBkColor($Button1, 0xD5E2ff)
    $Edit1 = GUICtrlCreateEdit("", 24, 150, 441, 353, BitOR($WS_VSCROLL, $ES_READONLY))
    GUICtrlSetBkColor($Edit1, 0xD5E2ff)
    $button2 = GUICtrlCreateButton("Exit", 405, 510, 70, 25)
    GUICtrlSetBkColor($button2, 0xD5E2ff)
    $label1 = GUICtrlCreateLabel("Afs-Chat by Philipp Buck", 220, 515, 180)
    GUICtrlSetFont($label1, 12.5)
    GUISetState(@SW_SHOW)
    Dim $Form1_AccelTable[1][2] = [["{Enter}", $Button1]]
    GUISetAccelerators($Form1_AccelTable)
    #EndRegion ### END Koda GUI section ###
    $start = TCPStartup()
    $mainsocket = TCPListen("127.0.0.1", 81)
    ;~ $mainsocket = TCPListen("192.168.100.136", 80)
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    GUISetState(@SW_HIDE)
    Case $Button1
    TCPStartup()
    $socket = TCPConnect("127.0.0.1", 80)
    ;~ $socket = TCPConnect("127.0.0.1", 81)
    If $socket = -1 Then ; Wenn $socket = -1 ist, Fehlermeldung ausgeben
    MsgBox(16, "Error", "Die Verbindung zum Server konnte nicht hergestellt werden!") ; Fehlermeldung
    EndIf
    $text = GUICtrlRead($Input1)
    GUICtrlSetData($Input1, "")
    $chat = GUICtrlRead($Edit1)
    GUICtrlSetData($Edit1, $chat & @UserName & ": " & $text & @CRLF)
    $sendedBytes = TCPSend($socket, @UserName & ": " & $text) ; Sendet den Text an unseren verbundenen Socket

    [/autoit] [autoit][/autoit] [autoit]

    If $sendedBytes = 0 Then ; Wenn der Rückgabewert von TCPSend(...) 0 ist, Fehlermeldung ausgeben
    MsgBox(16, "Error", "Das Paket konnte nicht gesendet werden.") ; Fehlermeldung
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    TCPCloseSocket($socket)
    TCPShutdown()
    Case $button2
    GUISetState(@SW_HIDE)
    EndSwitch
    $acceptedsocket = TCPAccept($mainsocket)
    If $acceptedsocket <> -1 Then ; Wenn $acceptedSocket ungleich -1 ist, ...
    $receivedData = TCPRecv($acceptedsocket, 1024) ; Wenn eine Socketverbindung hergestellt wurde, empfange ein Paket vom Client ($connectedSocket)
    $chat = GUICtrlRead($Edit1)
    GUICtrlSetData($Edit1, $chat & $receivedData & @CRLF)
    TCPCloseSocket($acceptedsocket)
    $tray = 0
    While $tray == 0
    $tray = TrayTip("Neue Nachricht", $receivedData, 0, 1)
    WEnd
    EndIf
    WEnd

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _exit()
    Exit
    EndFunc ;==>_exit

    [/autoit] [autoit][/autoit] [autoit]

    Func _show()
    GUISetState(@SW_SHOW)
    EndFunc ;==>_show

    [/autoit] [autoit][/autoit] [autoit]

    Func _hide()
    GUISetState(@SW_HIDE)
    EndFunc ;==>_hide

    [/autoit]

    mit der function kommt nur der tray tip

    Spoiler anzeigen
    [autoit]

    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_outfile_type=a3x
    #AutoIt3Wrapper_outfile=G:\Server.a3x
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    #include <array.au3>
    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    ;#####cars ####
    Global Const $_TBH_NIN_BALLOONSHOW = 0x0402
    Global Const $_TBH_NIN_BALLOONHIDE = 0x0403
    Global Const $_TBH_NIN_BALLOONTIMEOUT = 0x0404
    Global Const $_TBH_NIN_BALLOONUSERCLICK = 0x0405
    Global Const $_TBH_BALLOONMESSAGE = 0x040C
    Global $__TrayHookDLL=-1, $__TrayHookWin=-1
    ;##### Tray #####
    Opt("TrayOnEventMode", 1)
    Opt("TrayMenuMode", 1 + 2)
    $ausblenden = TrayCreateItem("Ausblenden")
    TrayItemSetOnEvent($ausblenden, "_hide")
    $einblenden = TrayCreateItem("Einblenden")
    TrayItemSetOnEvent($einblenden, "_show")
    $exititem = TrayCreateItem("Exit")
    TrayItemSetOnEvent($exititem, "_Exit")

    [/autoit] [autoit][/autoit] [autoit]

    ;#### #Gui #####
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Server", 479, 537, 485, 0, $ws_popup)
    GUISetBkColor(0xD5E2EA)
    $Pic1 = GUICtrlCreatePic(@ScriptDir & "AFS.jpeg", 35, 20, 408, 74)
    $Input1 = GUICtrlCreateInput("Hallo ;)", 24, 116, 313, 21)
    GUICtrlSetBkColor($Input1, 0xD5E2ff)
    $Button1 = GUICtrlCreateButton("Senden", 352, 116, 97, 22)
    GUICtrlSetBkColor($Button1, 0xD5E2ff)
    $Edit1 = GUICtrlCreateEdit("", 24, 150, 441, 353, BitOR($WS_VSCROLL, $ES_READONLY))
    GUICtrlSetBkColor($Edit1, 0xD5E2ff)
    $button2 = GUICtrlCreateButton("Exit", 405, 510, 70, 25)
    GUICtrlSetBkColor($button2, 0xD5E2ff)
    $label1 = GUICtrlCreateLabel("Afs-Chat by Philipp Buck", 220, 515, 180)
    GUICtrlSetFont($label1, 12.5)
    GUISetState(@SW_SHOW)
    Dim $Form1_AccelTable[1][2] = [["{Enter}", $Button1]]
    GUISetAccelerators($Form1_AccelTable)
    #EndRegion ### END Koda GUI section ###
    $start = TCPStartup()
    $mainsocket = TCPListen("127.0.0.1", 80)
    ;~ $mainsocket = TCPListen("192.168.100.140", 81)
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    GUISetState(@SW_HIDE)
    Case $Button1
    TCPStartup()
    $socket = TCPConnect("127.0.0.1", 81)
    ;~ $socket = TCPConnect("127.0.0.1", 81)
    If $socket = -1 Then ; Wenn $socket = -1 ist, Fehlermeldung ausgeben
    MsgBox(16, "Error", "Die Verbindung zum Server konnte nicht hergestellt werden!") ; Fehlermeldung
    EndIf
    $text = GUICtrlRead($Input1)
    GUICtrlSetData($Input1, "")
    $chat = GUICtrlRead($Edit1)
    GUICtrlSetData($Edit1, $chat & @UserName & ": " & $text & @CRLF)
    $sendedBytes = TCPSend($socket, @UserName & ": " & $text) ; Sendet den Text an unseren verbundenen Socket

    [/autoit] [autoit][/autoit] [autoit]

    If $sendedBytes = 0 Then ; Wenn der Rückgabewert von TCPSend(...) 0 ist, Fehlermeldung ausgeben
    MsgBox(16, "Error", "Das Paket konnte nicht gesendet werden.") ; Fehlermeldung
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    TCPCloseSocket($socket)
    TCPShutdown()
    Case $button2
    GUISetState(@SW_HIDE)
    EndSwitch
    $acceptedsocket = TCPAccept($mainsocket)
    If $acceptedsocket <> -1 Then ; Wenn $acceptedSocket ungleich -1 ist, ...
    $receivedData = TCPRecv($acceptedsocket, 1024) ; Wenn eine Socketverbindung hergestellt wurde, empfange ein Paket vom Client ($connectedSocket)
    $chat = GUICtrlRead($Edit1)
    GUICtrlSetData($Edit1, $chat & $receivedData & @CRLF)
    TCPCloseSocket($acceptedsocket)
    $tray = 0
    $X = _TrayHook_LoadDLL("AutoItBalloon.dll")
    $y = _TrayHook_Install()
    if $x+ $y == 2 Then
    $tray = TrayTip("Neue Nachricht", $receivedData, 30, 1)
    Else
    ConsoleWrite("fehler")
    EndIf
    EndIf
    WEnd

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _exit()
    Exit
    EndFunc ;==>_exit

    [/autoit] [autoit][/autoit] [autoit]

    Func _show()
    GUISetState(@SW_SHOW)
    EndFunc ;==>_show

    [/autoit] [autoit][/autoit] [autoit]

    Func _hide()
    GUISetState(@SW_HIDE)
    EndFunc ;==>_hide

    [/autoit] [autoit][/autoit] [autoit]

    Func _TrayHook_LoadDLL($Path= "AutoItBalloon.dll")
    ;Author: Prog@ndy
    If $__TrayHookDLL > -1 Then Return $__TrayHookDLL
    If StringTrimLeft($Path,StringInStr($Path,"\",0,-1)) <> "AutoItBalloon.dll" Then Return SetError(1,0,-1)
    $__TrayHookDLL = DllOpen($Path)
    Return $__TrayHookDLL
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ; @error: 1 if could not register
    ; 2 if Receiver-Function not found
    ; 3 if already registered
    Func _TrayHook_Install($FuncName="TRAYICONPROC")
    ;Author: Prog@ndy
    If IsHWnd($__TrayHookWin) Then Return SetError(3,0,0)
    Call($FuncName,0,0,0,0)
    If @error = 0xDEAD and @extended = 0xBEEF Then Return SetError(2,0,0)
    Local $Title = AutoItWinGetTitle()
    AutoItWinSetTitle(@ScriptName & TimerInit())
    Local $Match = Opt("WinTitleMatchMode",3)
    Local $AutoItWin = WinGetHandle(AutoItWinGetTitle())
    Opt("WinTitleMatchMode",$Match )
    AutoItWinSetTitle($Title)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $__TrayHookWin = GUICreate(@ScriptName & " Balloon Message Window")

    [/autoit] [autoit][/autoit] [autoit]

    Local $aResult = DllCall($__TrayHookDLL, "int", "InstallHook@8", "hwnd", $AutoItWin, "hwnd", $__TrayHookWin)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    If Not IsArray($aResult) Or $aResult[0] = 0 Then Return SetError(1,0,0)
    GUIRegisterMsg(0x040C, "TRAYICONPROC")
    Return 1
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _TrayHook_Remove()
    ; Prog@ndy
    DllCall($__TrayHookDLL, "none", "RemoveHook@0")
    GUIDelete($__TrayHookWin)
    $__TrayHookWin = -1
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func TRAYICONPROC($hwnd, $uMsg, $wParam, $lParam)
    If ($hwnd+$uMsg+$wParam+$lParam) = 0 Then Return
    ; Ereignisse für das TrayIcon
    Switch $uMsg
    Case $_TBH_BALLOONMESSAGE
    Local $uTrayMsg = BitAND($lParam, 0xFFFF)
    Local $nID = BitShift($lParam, 16)
    Switch $uTrayMsg
    Case $_TBH_NIN_BALLOONUSERCLICK
    ConsoleWrite("show" & @crlf)
    GUISetState(@SW_SHOW)
    EndSwitch
    EndSwitch
    EndFunc ;==>TRAYICONPROC

    [/autoit]


    was mache ich falsch

  • So passiert garnichts :
    8|

    Spoiler anzeigen
    [autoit]

    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_outfile_type=a3x
    #AutoIt3Wrapper_outfile=G:\Server.a3x
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    #include <array.au3>
    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    ;#####cars ####
    Global Const $_TBH_NIN_BALLOONSHOW = 0x0402
    Global Const $_TBH_NIN_BALLOONHIDE = 0x0403
    Global Const $_TBH_NIN_BALLOONTIMEOUT = 0x0404
    Global Const $_TBH_NIN_BALLOONUSERCLICK = 0x0405
    Global Const $_TBH_BALLOONMESSAGE = 0x040C
    Global $__TrayHookDLL=-1, $__TrayHookWin=-1
    ;##### Tray #####
    Opt("TrayOnEventMode", 1)
    Opt("TrayMenuMode", 1 + 2)
    $ausblenden = TrayCreateItem("Ausblenden")
    TrayItemSetOnEvent($ausblenden, "_hide")
    $einblenden = TrayCreateItem("Einblenden")
    TrayItemSetOnEvent($einblenden, "_show")
    $exititem = TrayCreateItem("Exit")
    TrayItemSetOnEvent($exititem, "_Exit")

    [/autoit] [autoit][/autoit] [autoit]

    ;#### #Gui #####
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Server", 479, 537, 485, 0, $ws_popup)
    GUISetBkColor(0xD5E2EA)
    $Pic1 = GUICtrlCreatePic(@ScriptDir & "AFS.jpeg", 35, 20, 408, 74)
    $Input1 = GUICtrlCreateInput("Hallo ;)", 24, 116, 313, 21)
    GUICtrlSetBkColor($Input1, 0xD5E2ff)
    $Button1 = GUICtrlCreateButton("Senden", 352, 116, 97, 22)
    GUICtrlSetBkColor($Button1, 0xD5E2ff)
    $Edit1 = GUICtrlCreateEdit("", 24, 150, 441, 353, BitOR($WS_VSCROLL, $ES_READONLY))
    GUICtrlSetBkColor($Edit1, 0xD5E2ff)
    $button2 = GUICtrlCreateButton("Exit", 405, 510, 70, 25)
    GUICtrlSetBkColor($button2, 0xD5E2ff)
    $label1 = GUICtrlCreateLabel("Afs-Chat by Philipp Buck", 220, 515, 180)
    GUICtrlSetFont($label1, 12.5)
    GUISetState(@SW_SHOW)
    Dim $Form1_AccelTable[1][2] = [["{Enter}", $Button1]]
    GUISetAccelerators($Form1_AccelTable)
    #EndRegion ### END Koda GUI section ###
    $start = TCPStartup()
    $mainsocket = TCPListen("127.0.0.1", 80)
    ;~ $mainsocket = TCPListen("192.168.100.140", 81)

    [/autoit] [autoit][/autoit] [autoit]

    ;####funks####
    Func _TrayHook_LoadDLL($Path= "AutoItBalloon.dll")
    ;Author: Prog@ndy
    If $__TrayHookDLL > -1 Then Return $__TrayHookDLL
    If StringTrimLeft($Path,StringInStr($Path,"\",0,-1)) <> "AutoItBalloon.dll" Then Return SetError(1,0,-1)
    $__TrayHookDLL = DllOpen($Path)
    Return $__TrayHookDLL
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ; @error: 1 if could not register
    ; 2 if Receiver-Function not found
    ; 3 if already registered
    Func _TrayHook_Install($FuncName="TRAYICONPROC")
    ;Author: Prog@ndy
    If IsHWnd($__TrayHookWin) Then Return SetError(3,0,0)
    Call($FuncName,0,0,0,0)
    If @error = 0xDEAD and @extended = 0xBEEF Then Return SetError(2,0,0)
    Local $Title = AutoItWinGetTitle()
    AutoItWinSetTitle(@ScriptName & TimerInit())
    Local $Match = Opt("WinTitleMatchMode",3)
    Local $AutoItWin = WinGetHandle(AutoItWinGetTitle())
    Opt("WinTitleMatchMode",$Match )
    AutoItWinSetTitle($Title)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $__TrayHookWin = GUICreate(@ScriptName & " Balloon Message Window")

    [/autoit] [autoit][/autoit] [autoit]

    Local $aResult = DllCall($__TrayHookDLL, "int", "InstallHook@8", "hwnd", $AutoItWin, "hwnd", $__TrayHookWin)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    If Not IsArray($aResult) Or $aResult[0] = 0 Then Return SetError(1,0,0)
    GUIRegisterMsg(0x040C, "TRAYICONPROC")
    Return 1
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _TrayHook_Remove()
    ; Prog@ndy
    DllCall($__TrayHookDLL, "none", "RemoveHook@0")
    GUIDelete($__TrayHookWin)
    $__TrayHookWin = -1
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    $X = _TrayHook_LoadDLL("AutoItBalloon.dll")
    $y = _TrayHook_Install()
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    GUISetState(@SW_HIDE)
    Case $Button1
    TCPStartup()
    $socket = TCPConnect("127.0.0.1", 81)
    ;~ $socket = TCPConnect("127.0.0.1", 81)
    If $socket = -1 Then ; Wenn $socket = -1 ist, Fehlermeldung ausgeben
    MsgBox(16, "Error", "Die Verbindung zum Server konnte nicht hergestellt werden!") ; Fehlermeldung
    EndIf
    $text = GUICtrlRead($Input1)
    GUICtrlSetData($Input1, "")
    $chat = GUICtrlRead($Edit1)
    GUICtrlSetData($Edit1, $chat & @UserName & ": " & $text & @CRLF)
    $sendedBytes = TCPSend($socket, @UserName & ": " & $text) ; Sendet den Text an unseren verbundenen Socket

    [/autoit] [autoit][/autoit] [autoit]

    If $sendedBytes = 0 Then ; Wenn der Rückgabewert von TCPSend(...) 0 ist, Fehlermeldung ausgeben
    MsgBox(16, "Error", "Das Paket konnte nicht gesendet werden.") ; Fehlermeldung
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    TCPCloseSocket($socket)
    TCPShutdown()
    Case $button2
    GUISetState(@SW_HIDE)
    EndSwitch
    $acceptedsocket = TCPAccept($mainsocket)
    If $acceptedsocket <> -1 Then ; Wenn $acceptedSocket ungleich -1 ist, ...
    $receivedData = TCPRecv($acceptedsocket, 1024) ; Wenn eine Socketverbindung hergestellt wurde, empfange ein Paket vom Client ($connectedSocket)
    $chat = GUICtrlRead($Edit1)
    GUICtrlSetData($Edit1, $chat & $receivedData & @CRLF)
    TCPCloseSocket($acceptedsocket)
    $tray = 0
    While $tray == 0
    $tray = TrayTip("Neue Nachricht", $receivedData, 30, 1)
    WEnd
    EndIf
    WEnd

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _exit()
    Exit
    EndFunc ;==>_exit

    [/autoit] [autoit][/autoit] [autoit]

    Func _show()
    GUISetState(@SW_SHOW)
    EndFunc ;==>_show

    [/autoit] [autoit][/autoit] [autoit]

    Func _hide()
    GUISetState(@SW_HIDE)
    EndFunc ;==>_hide

    [/autoit] [autoit][/autoit] [autoit]

    Func TRAYICONPROC($hwnd, $uMsg, $wParam, $lParam)
    If ($hwnd+$uMsg+$wParam+$lParam) = 0 Then Return
    ; Ereignisse für das TrayIcon
    Switch $uMsg
    Case $_TBH_BALLOONMESSAGE
    Local $uTrayMsg = BitAND($lParam, 0xFFFF)
    Local $nID = BitShift($lParam, 16)
    Switch $uTrayMsg
    Case $_TBH_NIN_BALLOONUSERCLICK
    ConsoleWrite("show" & @crlf)
    GUISetState(@SW_SHOW)
    EndSwitch
    EndSwitch
    EndFunc ;==>TRAYICONPROC

    [/autoit]