ssend (funktion um befehle an handle zu senden) verursacht klingeln.

  • moin leute ... ich woltle eich mal wieder mit meinen problemen belästigen :D

    ich verwende in meinem script eine nette funktion (Danke hamburger + SeoBu) names ssend

    leider verursacht diese immer diesen systemsound "ding" ... was recht nervig ist... woran kann das denn liegen ?

    oder liegts am contolsend ?

    bei einigen rechnern kommt das "ding" übrigens und bei anderen nicht ... am OS kanns nicht liegen ... hmmm bin ratlos :(

    hier ein anwendungsbeispiel:

    [autoit]

    Func _send4()
    Global $xxhWnd, $F4 = "hallo test"
    ;$xxhWnd = ControlGetHandle($consoletitle, "", $consoledit)
    ssend($xxhWnd, $F4)
    ssend($xxhWnd, "0D", 1)
    ControlSend($consoletitle, "", $consoledit, "{Enter}")
    EndFunc ;==>_send4

    [/autoit]


    udf ssend:

    Spoiler anzeigen
    [autoit]

    ; #FUNCTION# ======================================================================================
    ; Name ..........: ssend()
    ; Description ...: Sends a string to a specified Control
    ; Syntax ........: ssend($hWnd, $sString[, $iHex = 0[, $bSendMsg = False]])
    ; Parameters ....: $hWnd - Control Handle to send to.
    ; $sString - String to send
    ; $iHex - [optional] Determines wether you want to send pure hex, or not. (default:0)
    ; |This can be handy, if you want to send special keystrokes like ENTER (0D)
    ; |0 - Convert String to Hex first
    ; |1 - Do not convert string to Hex
    ; $bSendMsg - [optional] Determines weither you want to send WM_SETFOCUS and WM_ACTIVATE messages beforehand. (default:False)
    ; Return values .: On Success - Returns 1
    ; On Failure - Returns 0 and sets @error to
    ; |-1 $hWnd is not a Hwnd-Type var.
    ; |>1 error(s) occured when trying to send string
    ; Author ........: hamburger, modified by SEuBo
    ; =================================================================================================

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

    Func ssend($xxhWnd, $xxsString, $xxiHex = 0, $xxbSendMsg = False) ; senden an die console
    If Not IsHWnd($xxhWnd) Then Return SetError(-1, 0, 0)
    Local $xxaPar, $xxaText, $xxiErr
    if $debuglog = 1 then FileWrite("hktdebug.log"," pos 1a:"&$xxaPar& " 1b:" &$xxaText &" 1c:" &$xxiErr)
    ; 1. Get Parent Window. 2. Send WM_ACTIVATE to Parent. 3. Send WM_SETFOCUS to Control.
    If $xxbSendMsg Then
    $xxaPar = DllCall("user32.dll", "hwnd", "GetParent", "hwnd", $xxhWnd)
    If @error Then Dim $xxaPar[1] = [WinGetHandle("Program Manager")]
    _SendMessage($xxaPar[0], 0x0006, $xxsString, 0, 0, "int", "long")
    _SendMessage($xxhWnd, 0x7)
    EndIf
    if $debuglog = 1 then FileWrite("hktdebug.log"," pos 2a:"&$xxhWnd)
    ; Send WM_CHAR messages to Control.
    If $xxiHex Then _SendMessage($xxhWnd, 0x102, $xxsString, 0, 0, "int", "long")
    ;MsgBox(0,"","pos 3")
    If @error Then $xxiErr += 1
    If Not $xxiHex Then
    $xxaText = StringSplit($xxsString, "", 3)
    For $xxi = 0 To UBound($xxaText) - 1
    Sleep(1)
    _SendMessage($xxhWnd, 0x102, "0x" & Hex(StringToBinary($xxaText[$xxi])), 0, 0, "int", "long")
    If @error Then $xxiErr += 1
    Next
    EndIf
    if $debuglog = 1 then FileWrite("hktdebug.log"," pos 3a:"&$xxaText& " 3b:" &$xxsString)
    If $xxiErr Then Return SetError($xxiErr, 0, 0)
    Return SetError(0, 0, 1)
    ;~ _SendMessage($xxhwnd, 0x8)
    EndFunc ;==>ssend

    [/autoit]

    Einmal editiert, zuletzt von WhiteLion (27. Juli 2010 um 21:06)