• Hi,

    Ich habe mal ein DestktopStreamer gebaut. Bei mir und Kumpel liefs ehr moderat. Wie läufts bei euch ?

    Server: bitte den @ipaddress macro anpassen !

    Spoiler anzeigen
    [autoit]


    #include <ScreenCapture.au3>
    $TcpLenth = 8192
    FileDelete(@ScriptDir & "\Temp.jpg")
    Global $IP = @IPAddress3

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

    TCPStartup()

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

    $Socket = TCPListen($IP, 4412, 1)

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

    ConsoleWrite($IP & @CRLF)
    Do
    $Connection = TCPAccept($Socket)
    Until $Connection <> -1

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

    FileDelete(@ScriptDir & "\Temp.jpg")
    _ScreenCapture_SetJPGQuality(50)
    While 1
    _ScreenCapture_Capture(@ScriptDir & "\Temp.jpg")
    $File = FileOpen(@ScriptDir & "\Temp.jpg", 16)
    TCPSend($Connection, "SF")
    While 1
    $Read = FileRead($File, $TcpLenth)
    If @error Then
    TCPSend($Connection, "EOF")
    $Read = ""
    FileClose($File)
    FileDelete(@ScriptDir & "\Temp.jpg")
    ExitLoop
    EndIf
    TCPSend($Connection, $Read)
    If @error Then Exit
    WEnd
    WEnd

    [/autoit]


    Client

    Spoiler anzeigen
    [autoit]


    TCPStartup()
    $TcpLenth = 8192
    FileDelete(@ScriptDir & "\Screen.jpg")
    $IP = InputBox("IP", "Bitte Server IP eingeben.")

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

    $Connection = TCPConnect($IP, 4412)
    If $Connection < 0 Then
    MsgBox(16, "Error", "Konnte keine Verbindung herstellen!")
    _Exit()
    EndIf

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

    Opt("GUIOnEventMode",1)

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

    $gui = GUICreate("", 1024, 768, 1, 1)
    GUISetOnEvent(-3, "_Exit")
    $Pic = GUICtrlCreatePic("", 1, 1, 1024, 768)
    GUISetState(@SW_SHOW)

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

    While 1
    $Resv = TCPRecv($Connection, 2)
    If @error Then
    MsgBox(16, "Error", "Verbindung unterbrochen!")
    _Exit()
    EndIf
    If $Resv = "SF" Then
    $File = FileOpen(@ScriptDir & "\Screen.jpg", 1)
    If $File = -1 Then Exit
    While 1
    $Resv = TCPRecv($Connection, $TcpLenth)
    If @error Then
    MsgBox(16, "Error", "Verbindung unterbrochen!")
    _Exit()
    EndIf
    If $Resv = "EOF" Then
    $Resv = ""
    FileClose($File)
    GUICtrlSetImage($Pic, @ScriptDir & "\Screen.jpg")
    FileDelete(@ScriptDir & "\Screen.jpg")
    ExitLoop
    EndIf
    FileWrite($File, $Resv)
    WEnd
    EndIf
    WEnd

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

    Func _Exit()
    TCPShutdown()
    Exit
    EndFunc ;==>_Exit

    [/autoit]
  • kann dir zwar leider nicht weiter helfen, was das script angeht, aber die idee finde ich super! :D ich wollte schon immer ein lancontrol programm schrieben, wie es in der schule für den unterricht benutzt würde (visions, mastereye) und da ist das natürlich esentiell!

  • ja die ist echt langsam aber mach doch mal

    [autoit]

    $Screen = _ScreenCapture_Capture("")

    [/autoit]


    so müsste er den Screen in den Speicher laden und speichert ihn nicht vorher auf die Platte
    bin mir aber nicht sicher, nur ne Vermutung

  • Mach doch die JPG quali was niedriger, und den Aufnahmebereich vllt kleiner.
    Solle dann ungefähr so gut sein wie Teamviewer.

    Meine Projekte:
    ClipBoard Manager (beendet)
    Gutes ClipBoard Verwaltungs Programm mit nützlichen Funktionen.

    HTML Creator (beendet)
    Nützliches Tool um schnell ein eigenes HTML Dokument zu erstellen.

  • Hab den Thread gerade mehr oder minder zufällig gefunden. Hilft vllt dieses Script hier?

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>
    #include <GDIPlusConstants.au3>
    #include <WinAPI.au3>
    #include <Array.au3>
    #include <ScreenCapture.au3>
    _GDIPlus_Startup()

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

    $hCapture1 = _Capture(1, 1, 77, 55) ; Screencapture machen (Bereich 1,1 -> 77,55)
    $aTest = _GDIPlus_ImageGetColorArray($hCapture1) ; Farbinformationen in Array einlesen

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

    MouseMove(10, 10, 0)

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

    $hCapture2 = _Capture(1, 1, 77, 55) ; Neues Bild
    $aTest2 = _GDIPlus_ImageGetColorArray($hCapture2) ; Neues Bild einlesen

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

    $aUnterschiede = _GetColorDifferences($aTest, $aTest2) ; Unterschiede finden (Koordinaten)

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

    ;Ab hier dient es nur noch der Darstellugn.

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

    _Display($aTest, "Vorher") ; Vorher Bild anzeigen
    _Display($aTest2, "Nachher") ; Nachher Bild anzeigen
    _Display($aTest2, "Unterschiede", $aUnterschiede) ; Unterschiede anhand der Koordinaten markieren

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

    _ArrayDisplay($aUnterschiede, "Alle unterschiede:")

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

    _GDIPlus_Shutdown()

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

    Func _GetColorDifferences($aBefore, $aAfter)
    Local $iUB1[2] = [UBound($aBefore), UBound($aBefore, 2)], $iUB2[2] = [UBound($aAfter), UBound($aAfter, 2)]
    Local $iDim = $iUB1, $aRet[1][2] = [[0]], $iUB = 0
    If $iDim[0] > $iUB2[0] Then $iDim[0] = $iUB2[0]
    If $iDim[1] > $iUB2[1] Then $iDim[1] = $iUB2[1]

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

    For $i = 0 To $iDim[0] - 1
    For $j = 0 To $iDim[1] - 1
    If $aBefore[$i][$j] <> $aAfter[$i][$j] Then
    Local $iUB = UBound($aRet)
    ReDim $aRet[$iUB + 1][2]
    $aRet[$iUB][0] = $i
    $aRet[$iUB][1] = $j
    EndIf
    Next
    Next
    $aRet[0][0] = $iUB
    Return $aRet
    EndFunc ;==>_GetColorDifferences

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

    Func _GDIPlus_ImageGetColorArray($sFile)
    ; SEuBo - Thx to Andy for
    ; https://autoit.de/index.php?page…6673#post126673
    Local $iWidth, $iHeight, $iStride
    Local $hBitMap, $hBitMapData, $hPixelData
    If FileExists($sFile) Then $hBitMap = _GDIPlus_BitmapCreateFromFile($sFile)
    If Not FileExists($sFile) Then $hBitMap = _GDIPlus_BitmapCreateFromHBITMAP($sFile)
    $hBitMapData = _GDIPlus_BitmapLockBits($hBitMap, 0, 0, _GDIPlus_ImageGetWidth($hBitMap), _GDIPlus_ImageGetHeight($hBitMap), $GDIP_ILMREAD, $GDIP_PXF24RGB)
    If @error Then Return SetError(1, 0, 0)
    $iWidth = DllStructGetData($hBitMapData, "Width");Image width - Number of pixels in one scan line of the bitmap.
    $iHeight = DllStructGetData($hBitMapData, "Height");Image height - Number of scan lines in the bitmap.
    $hPixelData = DllStructCreate("ubyte[" & (Abs(DllStructGetData($hBitMapData, "Stride")) * ($iHeight)) & "]", DllStructGetData($hBitMapData, "Scan0"))
    _WinAPI_DeleteObject($hBitMap)
    _GDIPlus_BitmapUnlockBits($hBitMap, DllStructGetData($hPixelData, 1))

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

    Local $aReturn[$iWidth][$iHeight], $i = 1
    For $y = 0 To $iHeight - 1
    For $x = 0 To $iWidth - 1
    $aReturn[$x][$y] = "0x" & Hex(DllStructGetData($hPixelData, 1, $i + 2), 2) & Hex(DllStructGetData($hPixelData, 1, $i + 1), 2) & Hex(DllStructGetData($hPixelData, 1, $i), 2)
    $i += 3
    Next
    Next
    _GDIPlus_ImageDispose($hPixelData) ;destroys the pixeldatastruct, have to be done at end of the script!
    Return $aReturn
    EndFunc ;==>_GDIPlus_ImageGetColorArray

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

    Func _Display($aTest, $sTitle = "", $aDiff = 0)
    $hGUI = GUICreate($sTitle, UBound($aTest, 1) * 10, UBound($aTest, 2) * 10)
    If IsArray($aDiff) Then
    For $i = 1 To UBound($aDiff) - 1
    $aTest[$aDiff[$i][0]][$aDiff[$i][1]] = 0xFF0000
    Next
    EndIf

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

    For $1 = 0 To UBound($aTest) - 1
    For $2 = 0 To UBound($aTest, 2) - 1
    GUICtrlCreateGraphic($1 * 10, $2 * 10, 10, 10)
    GUICtrlSetBkColor(-1, $aTest[$1][$2])
    Next
    Next

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

    GUISetState()

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case -3
    ExitLoop
    EndSwitch
    WEnd
    GUIDelete($hGUI)
    EndFunc ;==>_Display

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

    Func _Capture($iLeft, $iTop, $iRight, $iBottom, $sFile = "")
    Local $iWidth = $iRight - $iLeft + 1, $iHeight = $iBottom - $iTop + 1
    If Mod($iWidth, 4) Then $iWidth += (4 - Mod($iWidth, 4))
    If Mod($iHeight, 4) Then $iHeight += (4 - Mod($iHeight, 4))
    $iRight = $iWidth + $iLeft -1
    $iBottom = $iHeight + $iTop -1
    ConsoleWrite("_ScreenCapture_Capture(" & $sFile & ", " & $iLeft & ", " & $iTop & ", " & $iRight & ", " & $iBottom & ")" & @CRLF)
    Return _ScreenCapture_Capture($sFile, $iLeft, $iTop, $iRight, $iBottom)
    EndFunc ;==>_Capture

    [/autoit]
  • Diese Funktion ist zu langsam:

    [autoit]

    _ScreenCapture_Capture()

    [/autoit]


    Und das überprüfen dauert auch zu lange...
    Wir haben schon an einer eigenen ScreenShot Funktion gearbeitet, und sind auch schon recht weit gekommen aber die Pixeldaten in ein Array einzulesen ist nicht das Problem ;).