HI,
dank der UDF von Carsten8, da Carsten8 inaktiv ist und scheinbar nur ich noch die aktuelle Version von AdcanceLCD habe hier diese nochmal
Spoiler anzeigen
; Logitech G19 UDF
; Autor: Carsten Schneider aka Carsten8
; Datum: 24.07.2010
; Veröffentlichung: 31.07.2010
; Diese UDF benötigt die AdvanceLcd (http://www.blitzforum.de/forum/viewtopic.php?p=362484) DLL
; sowie installierte Gerätetreiber. Das Copyright von AdvanceLcd besitzt ChristianK von blitzforum.de.
#region Variablen
; #CONSTANTS# ===================================================================================================================
Global Const $LCD_OK = 0
Global Const $LCD_ERROR = 1
Global Const $LCD_ERROR_NOT_INITIALIZED = 2
Global Const $LCD_ERROR_INVALID_PARAMETER = 3
Global Const $LCD_ERROR_NOT_FOUND = 4
Global Const $LCD_DEVICE_INVALID = -1
Global Const $LCD_DEVICE_MONO = 1
Global Const $LCD_DEVICE_COLOR = 2
Global Const $LCD_EVENT_CONFIGURE = 1
Global Const $LCD_EVENT_BUTTON = 2
Global Const $LCD_BUTTON_1 = 0x0001
Global Const $LCD_BUTTON_2 = 0x0002
Global Const $LCD_BUTTON_3 = 0x0004
Global Const $LCD_BUTTON_4 = 0x0008
Global Const $LCD_BUTTON_LEFT = 0x0100
Global Const $LCD_BUTTON_RIGHT = 0x0200
Global Const $LCD_BUTTON_OK = 0x0400
Global Const $LCD_BUTTON_CANCEL = 0x0800
Global Const $LCD_BUTTON_UP = 0x1000
Global Const $LCD_BUTTON_DOWN = 0x2000
Global Const $LCD_BUTTON_MENU = 0x4000
Global Const $LCD_PRIORITY_LOW = 1
Global Const $LCD_PRIORITY_NORMAL = 2
Global Const $LCD_PRIORITY_HIGH = 3
Global Const $LCD_COLOR_VISIBLE = 0xFFFFFF
Global Const $LCD_COLOR_INVISIBLE = 0
Global Const $LCD_FONT_DEFAULT = 0
Global Const $LCD_FONT_BOLD = 1
Global Const $LCD_FONT_ITALIC = 2
Global Const $LCD_FONT_UNDERLINE = 4
; ===============================================================================================================================
; #VARIABLEN# ===================================================================================================================
Global $dll = 0
Global $callback = -1
; ===============================================================================================================================
#endregion Variablen
; #FUNKTIONEN# ==================================================================================================================
; LcdDeInitialize
; LcdInitialize
; LcdLastError
; LcdAppletActive
; LcdAppletEnabled
; LcdAppledOpened
; LcdButtonState
; LcdConfigState
; LcdCreateApplet
; LcdDeleteApplet
; LcdSelectDevice
; LcdSetEventHandler [INSTABIL]
; LcdSetPriority
; LcdUpdate
; LcdWaitActivation
; LcdClear
; LcdDrawLine
; LcdDrawOval
; LcdDrawRect
; LcdEnableAntiAlias
; LcdSetColor
; LcdSetLineWidth
; LcdSetRotation
; LcdSetTarget
; LcdCreatePixmap
; LcdDeletePixamp
; LcdDrawPixmap
; LcdDrawPixmapRect
; LcdLoadAnimPixmap
; LcdLoadPixmap
; LcdPixmapHeight
; LcdPixmapWidth
; LcdDeleteFont
; LcdDrawText
; LcdLoadFont
; LcdSetFont
; LcdStringHeight
; LcdStringWidth
; ===============================================================================================================================
#region Library
; #FUNKTION# ====================================================================================================================
; Name ..........: LcdInitialize
; Beschreibung ..: Initialisiert AdvanceLcd
; Syntax ........: LcdInitialize([$sDLLPath = "advlcd.dll"])
; Parameter .....: $sDLLPath - Pfad zur advlcd.dll
; Rückgabewerte .: Erfolg - $LCD_OK
; Fehler - $LCD_ERROR
; Bemerkungen ...:
; Verwandt ......: LcdDeInitialize
; ===============================================================================================================================
Func LcdInitialize($sDLLPath = "advlcd.dll")
$dll = DllOpen($sDLLPath)
Local $ret = DllCall($dll, "int", "LcdInitialize")
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdInitialize
; #FUNKTION# ====================================================================================================================
; Name ..........: LcdDeInitialize
; Beschreibung ..: Deinitialisiert AdvanceLcd
; Syntax ........: LcdDeInitialize()
; Parameter .....:
; Rückgabewerte .:
; Bemerkungen ...: Vorher sollten alle Applets, Pixmaps etc. gelöscht werden.
; Verwandt ......: LcdInitialize
; ===============================================================================================================================
Func LcdDeInitialize()
If $callback <> -1 Then DllCallbackFree($callback)
Local $ret = DllCall($dll, "int", "LcdDeInitialize")
If @error Then Return SetError(1, @error, 0)
DllClose($dll)
Return $ret[0]
EndFunc ;==>LcdDeInitialize
; #FUNKTION# ====================================================================================================================
; Name ..........: LcdLastError
; Beschreibung ..: Gibt den letzten aufgetretenen Fehler zurück.
; Syntax ........: LcdLastError()
; Parameter .....:
; Rückgabewerte .: $LCD_OK, $LCD_ERROR, $LCD_ERROR_NOT_INITIALIZED, $LCD_ERROR_INVALID_PARAMETER oder $LCD_ERROR_NOT_FOUND
; Bemerkungen ...:
; Verwandt ......:
; ===============================================================================================================================
Func LcdLastError()
Local $ret = DllCall($dll, "int", "LcdLastError")
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdLastError
#endregion Library
#region Applet
; #FUNKTION# ====================================================================================================================
; Name ..........: LcdAppletActive
; Beschreibung ..: Mischung aus LcdAppletEnabled und LcdAppletOpened (siehe Bemerkungen)
; Syntax ........: LcdAppletActive($hApplet)
; Parameter .....: $hApplet - Das Handle des Applets
; Rückgabewerte .: Aktiviert - True
; Deaktiviert - False
; Bemerkungen ...: Gibt nur True zurück, wenn sowohl LcdAppletEnabled als auch LcdAppletOpened True zurück gibt.
; Verwandt ......: LcdWaitActivation LcdAppletEnabled LcdAppletOpened
; ===============================================================================================================================
Func LcdAppletActive($hApplet)
Local $ret = DllCall($dll, "int", "LcdAppletActive", "ptr", $hApplet)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdAppletActive
; #FUNKTION# ====================================================================================================================
; Name ..........: LcdAppletEnabled
; Beschreibung ..: Prüft, ob ein Applet aktiviert ist.
; Syntax ........: LcdAppletEnabled($hApplet)
; Parameter .....: $hApplet - Das Handle des Applets
; Rückgabewerte .: Aktiviert - True
; Deaktiviert - False
; Bemerkungen ...:
; Verwandt ......: LcdAppletOpened LcdAppletActive
; ===============================================================================================================================
Func LcdAppletEnabled($hApplet)
Local $ret = DllCall($dll, "int", "LcdAppletEnabled", "ptr", $hApplet)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdAppletEnabled
; #FUNKTION# ====================================================================================================================
; Name ..........: LcdAppletOpened
; Beschreibung ..: Prüft, ob das Applet auf dem LCD angezeigt werden darf oder nicht.
; Syntax ........: LcdAppletOpened($hApplet)
; Parameter .....: $hApplet - Das Handle des Applets
; Rückgabewerte .: Aktiviert - True
; Deaktiviert - False
; Bemerkungen ...:
; Verwandt ......: LcdAppletEnabled LcdAppletActive
; ===============================================================================================================================
Func LcdAppletOpened($hApplet)
Local $ret = DllCall($dll, "int", "LcdAppletOpened", "ptr", $hApplet)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdAppletOpened
; #FUNKTION# ====================================================================================================================
; Name ..........: LcdButtonState
; Beschreibung ..: Ermittelt den Status eines Knopfes des LCDs.
; Syntax ........: LcdButtonState($hApplet, $iButton)
; Parameter .....: $hApplet - Das Handle des Applets
; $iButton - Die ID des Knopfes
; Rückgabewerte .:
; Bemerkungen ...: $iButton kann, je nach Gerätetyp, eine der folgenden Variablen sein:
; $LCD_BUTTON_1
; $LCD_BUTTON_2
; $LCD_BUTTON_3
; $LCD_BUTTON_4
;
; $LCD_BUTTON_LEFT
; $LCD_BUTTON_RIGHT
; $LCD_BUTTON_OK
; $LCD_BUTTON_CANCEL
; $LCD_BUTTON_UP
; $LCD_BUTTON_DOWN
; $LCD_BUTTON_MENU
; Verwandt ......: LcdConfigState
; ===============================================================================================================================
Func LcdButtonState($hApplet, $iButton)
Local $ret = DllCall($dll, "int", "LcdButtonState", "ptr", $hApplet, "int", $iButton)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdButtonState
; #FUNKTION# ====================================================================================================================
; Name ..........: LcdConfigState
; Beschreibung ..: Prüft, ob der "Konfigurieren"-Button im LCD Manager gedrückt wurde.
; Syntax ........: LcdConfigState($hApplet)
; Parameter .....: $hApplet - Das Handle des Applets
; Rückgabewerte .: True, wenn der Button angeklickt wurde, ansonsten False.
; Bemerkungen ...:
; Verwandt ......: LcdButtonState
; ===============================================================================================================================
Func LcdConfigState($hApplet)
Local $ret = DllCall($dll, "int", "LcdConfigState", "ptr", $hApplet)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdConfigState
; #FUNKTION# ====================================================================================================================
; Name ..........: LcdCreateApplet
; Beschreibung ..: Erstellt ein Applet.
; Syntax ........: LcdCreateApplet($sName, [$iDevices = $LCD_DEVICE_COLOR, [$bConfigurable = 0, [$bAutostart = 0]]])
; Parameter .....: $sName - Der Name des Applets. Er wird später auf dem LCD und im LCD Manager angezeigt.
; $iDevices - Der Gerätetyp, der verwendet werden soll. Siehe Bemerkungen.
; $bConfigurable - Gibt an, ob der "Konfigurieren"-Button im LCD Manager anklickbar sein soll.
; $bAutostart - Gibt an, ob der LCD Manager das Applet automatisch starten kann.
; Rückgabewerte .: Erfolg - Ein Handle des Applets
; Bemerkungen ...: $iDevices kann entweder $LCD_DEVICE_MONO oder $LCD_DEVICE_COLOR sein. Wird beides verwendet, so muss
; bei späteren Aktionen das Gerät per LcdSelectDevice ausgewählt werden.
; Verwandt ......: LcdSelectDevice LcdDeleteApplet
; ===============================================================================================================================
Func LcdCreateApplet($sName, $iDevices = $LCD_DEVICE_COLOR, $bConfigurable = 0, $bAutostart = 0)
Local $ret = DllCall($dll, "ptr", "LcdCreateAppletW", "wstr", $sName, "int", $iDevices, "int", $bConfigurable, "int", $bAutostart)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdCreateApplet
; #FUNKTION# ====================================================================================================================
; Name ..........: LcdDeleteApplet
; Beschreibung ..: Löscht ein Applet.
; Syntax ........: LcdDeleteApplet($hApplet)
; Parameter .....: $hApplet - Das Handle des Applets
; Rückgabewerte .:
; Bemerkungen ...: Sollte vor LcdDeInitialize aufgerufen werden.
; Verwandt ......: LcdCreateApplet LcdDeInitialize
; ===============================================================================================================================
Func LcdDeleteApplet($hApplet)
Local $ret = DllCall($dll, "int", "LcdDeleteApplet", "ptr", $hApplet)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdDeleteApplet
; #FUNKTION# ====================================================================================================================
; Name ..........: LcdSelectDevice
; Beschreibung ..: Setzt ein Gerät als Ziel zukünftiger Aktionen.
; Syntax ........: LcdSelectDevice($hApplet, $iDevice)
; Parameter .....: $hApplet - Das Handle des Applets
; $iDevice - Der Gerätetyp des Geräts
; Rückgabewerte .:
; Bemerkungen ...: Nur benötigt für Funktionen, die Gerätespezifisch sind.
; Verwandt ......:
; ===============================================================================================================================
Func LcdSelectDevice($hApplet, $iDevice)
Local $ret = DllCall($dll, "int", "LcdSelectDevice", "ptr", $hApplet, "int", $iDevice)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdSelectDevice
; #FUNKTION# ====================================================================================================================
; Name ..........: LcdSetEventHandler
; Beschreibung ..: Legt eine Funktion als Eventhandler für ein Applet fest.
; Syntax ........: LcdSetEventHandler($hApplet, $EventHandler, [$hContext = 0])
; Parameter .....: $hApplet - Das Handle des Applets
; $EventHandler - Name der Funktion, die als Eventhandler dienen soll.
; $hContect -
; Rückgabewerte .:
; Bemerkungen ...: Die Funktion ist sehr instabil und kann zu Abstürzen des Scripts führen.
; Die Funktion muss immer folgende Parameter besitzen:
; _BeispielCallback($iEvent, $hContext, $iData)
; Verwandt ......:
; ===============================================================================================================================
Func LcdSetEventHandler($hApplet, $EventHandler, $hContext = 0)
If $callback <> -1 Then DllCallbackFree($callback)
$callback = DllCallbackRegister($EventHandler, "int", "int;ptr;int")
Local $ret = DllCall($dll, "int", "LcdSetEventHandler", "ptr", $hApplet, "ptr", DllCallbackGetPtr($callback), "ptr", $hContext)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdSetEventHandler
; #FUNKTION# ====================================================================================================================
; Name ..........: LcdSetPriority
; Beschreibung ..: Setzt die Anzeigepriorität und den Vordergrundstatus eines Applets.
; Syntax ........: LcdSetPriority($hApplet, $iPriority, $bForeground)
; Parameter .....: $hApplet - Das Handle des Applets
; $iPriority - Die zu setzende Priorität
; $bForeground - Der zu setzende Vordergrundstatus
; Rückgabewerte .:
; Bemerkungen ...: $iPriority kann eine der folgenden Variablen sein: $LCD_PRIORITY_LOW, $LCD_PRIORITY_NORMAL, $LCD_PRIORITY_HIGH
; Wenn $bForeground True ist, wird das Applet in den Vordergrund gerufen und ein eventuelles automatisches
; Durchwechseln der Applets wird deaktiviert. Wird $bForeground auf False gesetzt, wird das eventuelle
; automatische Durchwechseln fortgeführt.
; Verwandt ......:
; ===============================================================================================================================
Func LcdSetPriority($hApplet, $iPriority, $bForeground)
Local $ret = DllCall($dll, "int", "LcdSetPriority", "ptr", $hApplet, "int", $iPriority, "int", $bForeground)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdSetPriority
; #FUNKTION# ====================================================================================================================
; Name ..........: LcdUpdate
; Beschreibung ..: Aktualisiert das LCD und zeigt den aktuellen Buffer des Applets an.
; Syntax ........: LcdUpdate($hApplet, [$bSync = 0])
; Parameter .....: $hApplet - Das Handle des Applets
; $bSync - Gibt an, ob gewartet werden soll, bis der Buffer angezeigt wird, oder nicht.
; Rückgabewerte .:
; Bemerkungen ...: Wenn $bSync True ist, läuft das Script weiter, sobald der Inhalt des Buffers an den LCD Manger gesendet wurde.
; Wenn $bSync False ist, läuft das Script erst weiter, wenn der Inhalt des Buffers auf dem LCD angezeigt wird (ca. 30ms langsamer)
; Verwandt ......:
; ===============================================================================================================================
Func LcdUpdate($hApplet, $bSync = 0)
Local $ret = DllCall($dll, "int", "LcdUpdate", "ptr", $hApplet, "int", $bSync)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdUpdate
; #FUNKTION# ====================================================================================================================
; Name ..........: LcdWaitActivation
; Beschreibung ..: Wartet, bis das Applet aktiviert wird.
; Syntax ........: LcdWaitActivation($hApplet)
; Parameter .....: $hApplet - Das Handle des Applets
; Rückgabewerte .:
; Bemerkungen ...: Siehe LcdAppletActive
; Verwandt ......: LcdAppletActive
; ===============================================================================================================================
Func LcdWaitActivation($hApplet)
Local $ret = DllCall($dll, "int", "LcdWaitActivation", "ptr", $hApplet)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdWaitActivation
#endregion Applet
#region Graphics
; #FUNKTION# ====================================================================================================================
; Name ..........: LcdClear
; Beschreibung ..: Leert den Buffer des LCDs.
; Syntax ........: LcdClear($hApplet, [$iColor = 0x000000])
; Parameter .....: $hApplet - Das Handle des Applets
; $iColor - Die Farbe, mit der der Buffer überschrieben werden soll.
; Rückgabewerte .:
; Bemerkungen ...:
; Verwandt ......:
; ===============================================================================================================================
Func LcdClear($hApplet, $iColor = 0x000000)
Local $ret = DllCall($dll, "int", "LcdClear", "ptr", $hApplet, "int", $iColor)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdClear
; #FUNKTION# ====================================================================================================================
; Name ..........: LcdDrawLine
; Beschreibung ..:
; Syntax ........: LcdDrawLine($hApplet, $iX1, $iY1, $iX2, $iY2)
; Parameter .....:
; Rückgabewerte .:
; Bemerkungen ...:
; Verwandt ......:
; ===============================================================================================================================
Func LcdDrawLine($hApplet, $iX1, $iY1, $iX2, $iY2)
Local $ret = DllCall($dll, "int", "LcdDrawLine", "ptr", $hApplet, "int", $iX1, "int", $iY1, "int", $iX2, "int", $iY2)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdDrawLine
; #FUNKTION# ====================================================================================================================
; Name ..........:
; Beschreibung ..:
; Syntax ........:
; Parameter .....:
; Rückgabewerte .:
; Bemerkungen ...:
; Verwandt ......:
; ===============================================================================================================================
Func LcdDrawOval($hApplet, $iX, $iY, $iWidth, $iHeight, $bFill)
Local $ret = DllCall($dll, "int", "LcdDrawOval", "ptr", $hApplet, "int", $iX, "int", $iY, "int", $iWidth, "int", $iHeight, "int", $bFill)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdDrawOval
; #FUNKTION# ====================================================================================================================
; Name ..........:
; Beschreibung ..:
; Syntax ........:
; Parameter .....:
; Rückgabewerte .:
; Bemerkungen ...:
; Verwandt ......:
; ===============================================================================================================================
Func LcdDrawRect($hApplet, $iX, $iY, $iWidth, $iHeight, $bFill)
Local $ret = DllCall($dll, "int", "LcdDrawRect", "ptr", $hApplet, "int", $iX, "int", $iY, "int", $iWidth, "int", $iHeight, "int", $bFill)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdDrawRect
; #FUNKTION# ====================================================================================================================
; Name ..........:
; Beschreibung ..:
; Syntax ........:
; Parameter .....:
; Rückgabewerte .:
; Bemerkungen ...:
; Verwandt ......:
; ===============================================================================================================================
Func LcdEnableAntiAlias($hApplet, $bEnable)
Local $ret = DllCall($dll, "int", "LcdEnableAntiAlias", "ptr", $hApplet, "int", $bEnable)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdEnableAntiAlias
; #FUNKTION# ====================================================================================================================
; Name ..........:
; Beschreibung ..:
; Syntax ........:
; Parameter .....:
; Rückgabewerte .:
; Bemerkungen ...:
; Verwandt ......:
; ===============================================================================================================================
Func LcdSetColor($iColor)
Local $ret = DllCall($dll, "int", "LcdSetColor", "int", $iColor)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdSetColor
; #FUNKTION# ====================================================================================================================
; Name ..........:
; Beschreibung ..:
; Syntax ........:
; Parameter .....:
; Rückgabewerte .:
; Bemerkungen ...:
; Verwandt ......:
; ===============================================================================================================================
Func LcdSetLineWidth($hApplet, $fWidth)
Local $ret = DllCall($dll, "int", "LcdSetLineWidth", "ptr", $hApplet, "float", $fWidth)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdSetLineWidth
; #FUNKTION# ====================================================================================================================
; Name ..........:
; Beschreibung ..:
; Syntax ........:
; Parameter .....:
; Rückgabewerte .:
; Bemerkungen ...:
; Verwandt ......:
; ===============================================================================================================================
Func LcdSetRotation($hApplet, $fRotation, $iCenterX, $iCenterY)
Local $ret = DllCall($dll, "int", "LcdSetRotation", "ptr", $hApplet, "float", $fRotation, "int", $iCenterX, "int", $iCenterY)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdSetRotation
; #FUNKTION# ====================================================================================================================
; Name ..........: LcdSetTarget
; Beschreibung ..: Setzt das aktuelle Renderziel.
; Syntax ........: LcdSetTarget($hApplet, $hPixmap)
; Parameter .....: $hApplet - Das Handle des Applets, dessen Renderziel gesetzt werden soll.
; $hPixmap - Ein Handle zu einer Pixmap, welche das Renderziel sein soll. Bemerkungen beachten!
; Rückgabewerte .:
; Bemerkungen ...: $hPixmap kann nur eine Pixmap sein, die mit LcdCreatePixmap erstellt wurde.
; 0 verwenden, um das Renderziel zurückzusetzen.
; Verwandt ......: LcdCreatePixmap
; ===============================================================================================================================
Func LcdSetTarget($hApplet, $hPixmap)
Local $ret = DllCall($dll, "int", "LcdSetTarget", "ptr", $hApplet, "ptr", $hPixmap)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdSetTarget
#endregion Graphics
#region Pixmap
; #FUNKTION# ====================================================================================================================
; Name ..........: LcdCreatePixmap
; Beschreibung ..: Erstellt eine neue leere Pixmap
; Syntax ........: LcdCreatePixmap([$iWidth = 320, [$iHeight = 240, [$iDevice = $LCD_DEVICE_COLOR]]])
; Parameter .....: $iWidth - Breite der Pixmap
; $iHeight - Höhe der Pixmap
; $iDevice - Typ des Geräts, für das die Pixmap erstellt werden soll.
; Rückgabewerte .: Erfolg - Das Handle der Pixmap
; Bemerkungen ...:
; Verwandt ......: Lcd
; ===============================================================================================================================
Func LcdCreatePixmap($iWidth = 320, $iHeight = 240, $iDevice = $LCD_DEVICE_COLOR)
Local $ret = DllCall($dll, "ptr", "LcdCreatePixmap", "int", $iWidth, "int", $iHeight, "int", $iDevice)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdCreatePixmap
; #FUNKTION# ====================================================================================================================
; Name ..........: LcdDeletePixmap
; Beschreibung ..: Löscht eine Pixmap
; Syntax ........: LcdDeletePixmap($hPixmap)
; Parameter .....: $hPixmap - Das Handle der Pixmap, die gelöscht werden soll.
; Rückgabewerte .:
; Bemerkungen ...: Sollte vor LcdDeInitialize aufgerufen werden.
; Verwandt ......: LcdCreatePixmap LcdLoadPixmap LcdDeInitialize
; ===============================================================================================================================
Func LcdDeletePixmap($hPixmap)
Local $ret = DllCall($dll, "int", "LcdDeletePixmap", "ptr", $hPixmap)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdDeletePixmap
; #FUNKTION# ====================================================================================================================
; Name ..........: LcdDrawPixmap
; Beschreibung ..: Zeichnet eine Pixmap in den Buffer eines Applets.
; Syntax ........: LcdDrawPixmap($hApplet, [$hPixmap, [$iX = 0, [$iY = 0, [$iFrame = 0]]]])
; Parameter .....: $hApplet - Das Applet, in dessen Buffer die Pixmap gezeichnet werden soll.
; $hPixmap - Die Pixmap, die gezeichnet werden soll.
; $iX - Die X-Koordinate, der oberen linken Ecke der Pixmap
; $iY - Die Y-Koordinate, der oberen linken Ecke der Pixmap
; $iFrame - Die Framezahl, sollte die Pixmap mit LcdLoadAnimPixmap erstellt worden sein.
; Rückgabewerte .:
; Bemerkungen ...:
; Verwandt ......: LcdLoadAnimPixmap
; ===============================================================================================================================
Func LcdDrawPixmap($hApplet, $hPixmap, $iX = 0, $iY = 0, $iFrame = 0)
Local $ret = DllCall($dll, "int", "LcdDrawPixmap", "ptr", $hApplet, "ptr", $hPixmap, "int", $iX, "int", $iY, "int", $iFrame)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdDrawPixmap
; #FUNKTION# ====================================================================================================================
; Name ..........:
; Beschreibung ..:
; Syntax ........:
; Parameter .....:
; Rückgabewerte .:
; Bemerkungen ...:
; Verwandt ......:
; ===============================================================================================================================
Func LcdDrawPixmapRect($hApplet, $hPixmap, $iX, $iY, $iSX, $iSY, $iWidth, $iHeight, $iFrame)
Local $ret = DllCall($dll, "int", "LcdDrawPixmap", "ptr", $hApplet, "ptr", $hPixmap, "int", $iX, "int", $iY, "int", $iSX, "int", $iSY, "int", $iWidth, "int", $iHeight, "int", $iFrame)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdDrawPixmapRect
; #FUNKTION# ====================================================================================================================
; Name ..........:
; Beschreibung ..:
; Syntax ........:
; Parameter .....:
; Rückgabewerte .:
; Bemerkungen ...:
; Verwandt ......:
; ===============================================================================================================================
Func LcdLoadAnimPixmap($sFile, $iFrameWidth, $iFrameHeight, $iFrames)
Local $ret = DllCall($dll, "ptr", "LcdLoadAnimPixmapW", "wstr", $sFile, "int", $iFrameWidth, "int", $iFrameHeight, "int", $iFrames)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdLoadAnimPixmap
; #FUNKTION# ====================================================================================================================
; Name ..........: LcdLoadPixmap
; Beschreibung ..:
; Syntax ........: LcdLoadPixmap($sFile)
; Parameter .....: $sFile - Der Pfad zu der Bilddatei, die geladen werden soll.
; Rückgabewerte .: Erfolg - Das Handle der Pixmap
; Bemerkungen ...: Unterstützte Formate: JPG, PNG, BMP, TIFF und GIF
; Verwandt ......: LcdCreatePixmap LcdDeletePixmap
; ===============================================================================================================================
Func LcdLoadPixmap($sFile)
Local $ret = DllCall($dll, "ptr", "LcdLoadPixmapW", "wstr", $sFile)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdLoadPixmap
; #FUNKTION# ====================================================================================================================
; Name ..........:
; Beschreibung ..:
; Syntax ........:
; Parameter .....:
; Rückgabewerte .:
; Bemerkungen ...:
; Verwandt ......:
; ===============================================================================================================================
Func LcdPixmapWidth($hPixmap)
Local $ret = DllCall($dll, "int", "LcdPixmapWidth", "ptr", $hPixmap)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdPixmapWidth
; #FUNKTION# ====================================================================================================================
; Name ..........:
; Beschreibung ..:
; Syntax ........:
; Parameter .....:
; Rückgabewerte .:
; Bemerkungen ...:
; Verwandt ......:
; ===============================================================================================================================
Func LcdPixmapHeight($hPixmap)
Local $ret = DllCall($dll, "int", "LcdPixmapHeight", "ptr", $hPixmap)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdPixmapHeight
#endregion Pixmap
#region Font
; #FUNKTION# ====================================================================================================================
; Name ..........:
; Beschreibung ..:
; Syntax ........:
; Parameter .....:
; Rückgabewerte .:
; Bemerkungen ...:
; Verwandt ......:
; ===============================================================================================================================
Func LcdDeleteFont($hFont)
Local $ret = DllCall($dll, "int", "LcdDeleteFont", "ptr", $hFont)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdDeleteFont
; #FUNKTION# ====================================================================================================================
; Name ..........:
; Beschreibung ..:
; Syntax ........:
; Parameter .....:
; Rückgabewerte .:
; Bemerkungen ...:
; Verwandt ......:
; ===============================================================================================================================
Func LcdDrawText($hApplet, $sString, $iX, $iY)
Local $ret = DllCall($dll, "int", "LcdDrawTextW", "ptr", $hApplet, "wstr", $sString, "int", $iX, "int", $iY)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdDrawText
; #FUNKTION# ====================================================================================================================
; Name ..........:
; Beschreibung ..:
; Syntax ........:
; Parameter .....:
; Rückgabewerte .:
; Bemerkungen ...:
; Verwandt ......:
; ===============================================================================================================================
Func LcdLoadFont($sFamily, $iHeight, $iFlags, $sFile)
Local $ret = DllCall($dll, "ptr", "LcdLoadFontW", "wstr", $sFamily, "int", $iHeight, "int", $iFlags, "wstr", $sFile)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdLoadFont
; #FUNKTION# ====================================================================================================================
; Name ..........:
; Beschreibung ..:
; Syntax ........:
; Parameter .....:
; Rückgabewerte .:
; Bemerkungen ...:
; Verwandt ......:
; ===============================================================================================================================
Func LcdSetFont($hApplet, $hFont)
Local $ret = DllCall($dll, "int", "LcdSetFont", "ptr", $hApplet, "ptr", $hFont)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdSetFont
; #FUNKTION# ====================================================================================================================
; Name ..........:
; Beschreibung ..:
; Syntax ........:
; Parameter .....:
; Rückgabewerte .:
; Bemerkungen ...:
; Verwandt ......:
; ===============================================================================================================================
Func LcdStringHeight($hApplet, $sString)
Local $ret = DllCall($dll, "int", "LcdStringHeightW", "ptr", $hApplet, "wstr", $sString)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdStringHeight
; #FUNKTION# ====================================================================================================================
; Name ..........:
; Beschreibung ..:
; Syntax ........:
; Parameter .....:
; Rückgabewerte .:
; Bemerkungen ...:
; Verwandt ......:
; ===============================================================================================================================
Func LcdStringWidth($hApplet, $sString)
Local $ret = DllCall($dll, "int", "LcdStringWidthW", "ptr", $hApplet, "wstr", $sString)
If @error Then Return SetError(1, @error, 0)
Return $ret[0]
EndFunc ;==>LcdStringWidth
#endregion Font
, habe ich eine Script für das G19 geschrieben, welches den Downloadstatus des aktuellen Downloads anzeigt.
Die einzige Einstellung die am JDownloader gemacht werden muss, ist die Erweiterung "Remote Control" mit dem Standartport "10025" zu aktivieren.
Hier nun die benötigten Komponenten für das Script.
Dann noch die entsprechende DLL aus AdvanceLcd. Im herruntergladenen Archiv unter Binary und dann entsprechend dem Betriebsystem x64 oder x86 zu finden.
Und hier nun das eigentliche Script (die fünf Funktionen oben sind drin weil diese in der UDF fehlen) mit der bitte um Feadback:
Spoiler anzeigen
#include <String.au3>
#include <AdvanceLCD.au3>
#include <Array.au3>
LcdInitialize()
$hApplet = LcdCreateApplet("JDownloader", 2, 1, 1)
LcdSetTarget($hApplet, 0)
LcdWaitActivation($hApplet)
$hFont = LcdLoadFont("Arial", 23, $LCD_FONT_DEFAULT, "arial.ttf")
LcdSetFont($hApplet, $hFont)
LcdSetPriority($hApplet, $LCD_PRIORITY_NORMAL, 1)
$pause = 0
[/autoit] [autoit][/autoit] [autoit]While 1
Sleep(100)
If BinaryToString(InetRead("http://localhost:10025/get/downloadstatus", 17)) == "RUNNING" Then
If LcdButtonState($hApplet, $LCD_BUTTON_OK) = 1 Then
InetRead("http://localhost:10025/action/pause", 17)
If $pause = 0 Then
$pause = 1
Else
$pause = 0
EndIf
EndIf
LcdClear($hApplet, 0x000000)
[/autoit] [autoit][/autoit] [autoit]$downliste = BinaryToString(InetRead("http://localhost:10025/get/downloads/currentlist", 17))
$download = _StringBetween($downliste, "<file ", "/>")
$filename = _StringBetween($download[0], 'file_name="', '"')
$filepercent = _StringBetween($download[0], 'file_percent="', '"')
$fileeta = _StringBetween($download[0], 'file_status="', '"')
$filepackage = _StringBetween($download[0], 'file_package="', '"')
LcdDrawText($hApplet, $filename[0], 0, 0)
$prozent = $filepercent[0] & "%"
$prozentlaenge = 319 - (LcdStringWidth($hApplet, $prozent))
LcdDrawText($hApplet, $prozent, $prozentlaenge, 25)
$progressprozent = Round($filepercent[0])
$progressanzahl = Round((40 / 100) * $progressprozent)
$progresstext = ""
For $i = 1 To $progressanzahl Step 1
$progresstext = $progresstext & "|"
Next
LcdDrawText($hApplet, $progresstext, 0, 25)
LcdDrawText($hApplet, $fileeta[0], 0, 50)
LcdDrawText($hApplet, $filepackage[0], 0, 75)
If $pause = 1 Then
$pause = 1
$pauseFont = LcdLoadFont("Arial", 40, $LCD_FONT_DEFAULT, "arial.ttf")
LcdSetFont($hApplet, $pauseFont)
$xwert = 160 - (LcdStringWidth($hApplet, "Pause") / 2)
LcdDrawText($hApplet, "Pause", $xwert, 125)
LcdSetFont($hApplet, $hFont)
EndIf
$laufendedownloads = BinaryToString(InetRead("http://localhost:10025/get/downloads/currentcount", 17))
LcdDrawText($hApplet, "Laufende Downloads: " & $laufendedownloads, 0, 190)
$fertigedownloads = BinaryToString(InetRead("http://localhost:10025/get/downloads/finishedcount", 17))
$gesamtedownloads = BinaryToString(InetRead("http://localhost:10025/get/downloads/allcount", 17))
LcdDrawText($hApplet, "Gesamt fertig: " & $fertigedownloads & "/" & $gesamtedownloads, 0, 215)
LcdUpdate($hApplet, 0)
Else
$keindownloadFont = LcdLoadFont("Arial", 40, $LCD_FONT_DEFAULT, "arial.ttf")
LcdSetFont($hApplet, $keindownloadFont)
$keindownloadtext = "kein Download aktiv"
$keindownloadlaenge = 160 - (LcdStringWidth($hApplet, $keindownloadtext) / 2)
$keindownloadhoehe = 120 - (LcdStringHeight($hApplet, $keindownloadtext) / 2)
LcdDrawText($hApplet, $keindownloadtext, $keindownloadlaenge, $keindownloadhoehe)
LcdUpdate($hApplet, 0)
$hFont = LcdLoadFont("Arial", 23, $LCD_FONT_DEFAULT, "arial.ttf")
LcdSetFont($hApplet, $hFont)
EndIf
WEnd
Func killfunc()
LcdDeleteApplet($hApplet)
LcdDeInitialize()
EndFunc ;==>killfunc
Wenn man auf "OK" auf der G19 drück kann man den Download pausieren und mit einem erneuten betätigen der Taste "OK" wieder fortsetzen.