Free AutoIt Object - GUIs auf dem Bildschirm
[Blockierte Grafik: http://img109.imageshack.us/img109/5246/indexmr.png]
© by Reaker (Logo)
Was ist "Free AutoIt Object" ?
"Free AutoIt Object" ist eine Erfindung von mir, in Zusammen Arbeit mit H2112 !
Mit "Free AutoIt Object" ist es möglich, Labels, Buttons, eine komplette GUI aus einzelnen Stücken auf den Bildschirm zu kreieren !
Eine komplette GUI nur auf dem Bildschirm !
Es gibt auch noch mehr statt nur langweilige Buttons oder Labels, und andere Sachen die Koda zu bieten hat !
Layer, Multi-Fensterchen/Fenster ---- all dies ist mit "Free AutoIt Object" möglich !
Wie benutze ich das "Free AutoIt Object" ?
Ein was kann ich ja los werden: Mit den Pfeiltasten kann man steuern welchen "Action-String" man grade ausgewählt hat, näheres im Beispiel !
Noch gibt es keine ausführliche Erklärung, diese folgt aber noch heute (für die jetzigen Funktionen) !
Was gibt es bis jetzt ?
Bis jetzt gibt es nur diese Funktionen:
_AutoIt_FreeObject_ActionStringDraw()
_AutoIt_FreeObject_StringDraw()
_AutoIt_FreeObject_LayerCreate()
Allerdings kommen heute bestimmt noch einige dazu !
Ein Beispiel Script
Hier ist mal ein Beispiel, was es alles gibt (bis jetzt):
Ein Beispiel Bild:
[Blockierte Grafik: http://img218.imageshack.us/img218/4941/beispield.png]
Beispiel des Codes
Global $AllNumbers[2] = [0, 0]
Global $AllStrings = 2
Opt("TrayIconHide", 1)
#include <FreeObject.au3>
_StartUp("Free Object", @DesktopWidth, @DesktopHeight, 0, 0) ;Startet Transparentes Fenster
$image = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\AutoIt Free Object.PNG")
While 1
$MouseGetPos = MouseGetPos()
$Title = WinGetTitle("[active]")
_AutoIt_FreeObject_Action()
_AutoIt_FreeObject_ActionStringDraw(1, $Title, "Action 1", 0, 50, "")
_AutoIt_FreeObject_ActionStringDraw(2, $Title, "Action 2", 0, 100, "")
_AutoIt_FreeObject_StringDraw("Überschrift", $Title, 0, 0, 20)
_AutoIt_FreeObject_LayerCreate("Hallo, mein Name ist Mattthias !", WinGetPos(WinGetTitle("[active]")), 200, 20, 290, 30)
_Update() ;Trägt sachen aus Back to Front Buffer
If _IsPressed("1B") Then
ExitLoop
EndIf
WEnd
_ShutDown() ;Nach nutzen wieder ressourcen frei geben und runterfahren
Als FreeObject.au3 speichern für UDF
#include <GDIPlus.au3>
#include <Misc.au3>
Opt("GUIOnEventMode", 1)
Global $ActionStrings = 1
[/autoit] [autoit][/autoit] [autoit]#cs
Das ist H2112 seine Schöpfung
#ce
Global $hWnd, $hGraphic, $hBitmap, $backbuffer
Global $ScreenDc, $dc, $tSize, $pSize, $tSource, $pSource, $tBlend, $pBlend, $tPoint, $pPoint, $gdibitmap
Func _StartUp($title, $width, $height, $X, $Y)
$hWnd = GUICreate($title, $width, $height, $X, $Y, 0x80000000, BitOR(0x00000080, 0x00080000, 0x00000008))
GUISetOnEvent(-3, "_ShutDown")
GUISetState()
_GDIPlus_Startup()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd)
$hBitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $hGraphic)
$backbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsSetSmoothingMode($backbuffer, 4)
$ScreenDc = _WinAPI_GetDC($hWnd)
$dc = _WinAPI_CreateCompatibleDC($ScreenDc)
$tSize = DllStructCreate($tagSIZE)
$pSize = DllStructGetPtr($tSize)
DllStructSetData($tSize, "X", $width)
DllStructSetData($tSize, "Y", $height)
$tSource = DllStructCreate($tagPOINT)
$pSource = DllStructGetPtr($tSource)
$tBlend = DllStructCreate($tagBLENDFUNCTION)
$pBlend = DllStructGetPtr($tBlend)
DllStructSetData($tBlend, "Alpha", 255)
DllStructSetData($tBlend, "Format", 1)
$tPoint = DllStructCreate($tagPOINT)
$pPoint = DllStructGetPtr($tPoint)
DllStructSetData($tPoint, "X", 0)
DllStructSetData($tPoint, "Y", 0)
EndFunc ;==>_StartUp
Func _ShutDown()
_WinAPI_DeleteDC($dc)
_WinAPI_ReleaseDC($hWnd, $ScreenDc)
_GDIPlus_GraphicsDispose($backbuffer)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
GUIDelete($hWnd)
Exit
EndFunc ;==>_ShutDown
Func _UpDate()
$gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
_WinAPI_SelectObject($dc, $gdibitmap)
_WinAPI_UpdateLayeredWindow($hWnd, $ScreenDc, 0, $pSize, $dc, $pSource, 0, $pBlend, 2)
_WinAPI_DeleteObject($gdibitmap)
EndFunc ;==>_UpDate
#cs
;Das war H2112 seine Schöpfung !
#ce
#cs
Meine FreeObject Schöpfung
#ce
Global $ActualString = 0
Global $Timer = TimerInit()
Global $TimerDiff = TimerDiff($Timer)
#cs
; Func Name: _D3D9_StringDraw($String, $WindowTitle, $X, $Y[, $Brush = 0xFF000000[,$Size = 13[,$Big=0]]])
; Parameters: $String = The String to Write
; $WindowTitle = Title of the D3D9 Window
; $X = X Position in the Window where the String is to draw
; $Y = Y Position in the Window where the String is to draw
; $Brush = The Brush which used
;
; Includes: <GDIPlus.au3>
; <Transparent.au3> (made by H2112, © H2112)
;
; What does it: Draw a String in a Window
#ce
Func _AutoIt_FreeObject_StringDraw($String, $WindowTitle, $WindowX, $WindowY, $iSize = 15, $brush = 0xA50029)
Local $WinPosition = WinGetPos($WindowTitle)
$State = WinGetState($WindowTitle)
If BitAND($State, Then
$Family = _GDIPlus_FontFamilyCreate("Arial")
$Font = _GDIPlus_FontCreate($Family, $iSize, 1)
$Layout = _GDIPlus_RectFCreate($WinPosition[0] + $WindowX + 1, $WinPosition[1] + $WindowY + 27, @DesktopWidth, @DesktopHeight)
$Format = _GDIPlus_StringFormatCreate()
$brush = _GDIPlus_BrushCreateSolid($brush + 0xFF000000)
$Info = _GDIPlus_GraphicsMeasureString($backbuffer, $String, $Font, $Layout, $Format)
_GDIPlus_GraphicsDrawStringEx($backbuffer, $String, $Font, $Info[0], $Format, $brush)
EndIf
EndFunc ;==>_AutoIt_FreeObject_StringDraw
Func _AutoIt_FreeObject_ActionStringDraw($Number, $WindowTitle, $String, $WindowX, $WindowY, $Action, $ActionBrush = 0xCE0029, $SelectedBrush = 0x3100CE, $brush = 0xA50029)
Local $ArrayNumber = $Number - 1
Local $WinPosition = WinGetPos($WindowTitle)
$State = WinGetState($WindowTitle)
If BitAND($State, Then
Switch $ActionStrings
Case $Number
$Family = _GDIPlus_FontFamilyCreate("Arial")
$Font = _GDIPlus_FontCreate($Family, 15, 1)
$Layout = _GDIPlus_RectFCreate($WinPosition[0] + $WindowX + 1, $WinPosition[1] + $WindowY + 27, @DesktopWidth, @DesktopHeight)
$Format = _GDIPlus_StringFormatCreate()
$brush = _GDIPlus_BrushCreateSolid($SelectedBrush + 0xFF000000)
$Info = _GDIPlus_GraphicsMeasureString($backbuffer, $String, $Font, $Layout, $Format)
_GDIPlus_GraphicsDrawStringEx($backbuffer, $String, $Font, $Info[0], $Format, $brush)
Case Else
$Family = _GDIPlus_FontFamilyCreate("Arial")
$Font = _GDIPlus_FontCreate($Family, 15, 1)
$Layout = _GDIPlus_RectFCreate($WinPosition[0] + $WindowX + 1, $WinPosition[1] + $WindowY + 27, @DesktopWidth, @DesktopHeight)
$Format = _GDIPlus_StringFormatCreate()
$brush = _GDIPlus_BrushCreateSolid($brush + 0xFF000000)
$Info = _GDIPlus_GraphicsMeasureString($backbuffer, $String, $Font, $Layout, $Format)
_GDIPlus_GraphicsDrawStringEx($backbuffer, $String, $Font, $Info[0], $Format, $brush)
EndSwitch
If $AllNumbers[$ArrayNumber] = $Number And NOT ($Number = $ActionStrings) Then
_GDIPlus_GraphicsClear($backbuffer, 0x00000000)
$Family = _GDIPlus_FontFamilyCreate("Arial")
$Font = _GDIPlus_FontCreate($Family, 15, 1)
$Layout = _GDIPlus_RectFCreate($WinPosition[0] + $WindowX + 1, $WinPosition[1] + $WindowY + 27, @DesktopWidth, @DesktopHeight)
$Format = _GDIPlus_StringFormatCreate()
$brush = _GDIPlus_BrushCreateSolid($ActionBrush + 0xFF000000)
$Info = _GDIPlus_GraphicsMeasureString($backbuffer, $String, $Font, $Layout, $Format)
_GDIPlus_GraphicsDrawStringEx($backbuffer, $String, $Font, $Info[0], $Format, $brush)
Execute($Action)
EndIf
EndIf
EndFunc ;==>_AutoIt_FreeObject_ActionStringDraw
Func _AutoIt_FreeObject_LayerCreate($String, $WinGetPos, $WindowX, $WindowY, $width, $height)
Local $MouseGetPos = MouseGetPos()
Local $Brush = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
Local $Pen1 =_GDIPlus_PenCreate(0xFF4A514A)
Local $Pen2 = _GDIPlus_PenCreate(0xFF737173)
Local $Pen3 = _GDIPlus_PenCreate(0xFF8C8A8C)
Local $Pen4 = _GDIPlus_PenCreate(0xFF000000)
_GDIPlus_GraphicsFillRect($backbuffer, $WinGetPos[0] + $WindowX, $WinGetPos[1] + $WindowY, $width - 5, $height - 5, $Brush)
_GDIPlus_GraphicsDrawRect($backbuffer, $WinGetPos[0] + $WindowX - 1, $WinGetPos[1] + $WindowY - 1, $width - 8, $height - 8, $Pen1)
_GDIPlus_GraphicsDrawRect($backbuffer, $WinGetPos[0] + $WindowX - 2, $WinGetPos[1] + $WindowY - 2, $width - 6, $height - 6, $Pen2)
_GDIPlus_GraphicsDrawRect($backbuffer, $WinGetPos[0] + $WindowX - 3, $WinGetPos[1] + $WindowY - 3, $width - 4, $height - 4, $Pen3)
_GDIPlus_GraphicsDrawRect($backbuffer, $WinGetPos[0] + $WindowX - 4, $WinGetPos[1] + $WindowY - 4, $width - 2, $height - 2, $Pen4)
_GDIPlus_GraphicsDrawString($backbuffer, $String, $WinGetPos[0] + $WindowX - 1, $WinGetPos[1] + $WindowY - 1, "Arial", 15)
_GDIPlus_BrushDispose($Brush)
_GDIPlus_PenDispose($Pen1)
_GDIPlus_PenDispose($Pen2)
_GDIPlus_PenDispose($Pen3)
_GDIPlus_PenDispose($Pen4)
EndFunc ;==>_AutoIt_FreeObject_LayerCreate
Func _AutoIt_FreeObject_Action()
_GDIPlus_GraphicsClear($backbuffer, 0x00000000)
If _IsPressed("26") And TimerDiff($Timer) >= 500 And $ActualString - 1 >= 1 Then
$Timer = TimerInit()
$ActualString -= 1
$ActionStrings = $ActualString
ElseIf _IsPressed("28") And TimerDiff($Timer) >= 500 And $ActualString + 1 <= $AllStrings Then
$Timer = TimerInit()
$ActualString += 1
$ActionStrings = $ActualString
EndIf
EndFunc ;==>_AutoIt_FreeObject_Action
#cs
;Für Button
;If ($MouseGetPos[0] >= $WinGetPos[0] + $WindowX And $MouseGetPos[0] <= $WinGetPos[0] + $WindowX + $width) and ($MouseGetPos[1] >= $WinGetPos[1] + $WindowY And $MouseGetPos[1] <= $WinGetPos[1] + $WindowY + $height) And WinActive($WindowTitle) And _IsPressed("01") Then
; Execute($Action)
;EndIf
#ce
Bewertungen, Kritik, Anregungen und dergleichen sind gern gesehen !
Ein Download mit dem BSP Script gibt es im Anhang !
© by EliteMattthias and H2112