Sorry, ich muss hier pushen.
Es ist ziemlich dringend und ich bekomme es selbst leider nicht auf die Reihe...
Beiträge von $var
-
-
[autoit]
@ScriptDir
[/autoit][autoit][/autoit][autoit]
@DesktopDir
@MyDocumentsDir
; usw...; Such mal in der Hilfe nach "Makros".
[/autoit] -
Ich melde mich nun wieder.
Leider komme ich mit der Funktion nicht zurecht.
Wenn ich sie gleich nach der Erstellung des Inputs anwende, funktioniert es perfekt.
Rufe ich die Funktion aber später auf (siehe Beispielscript #2), scheint es irgendwie zu spinnen...
Es blinkt die ganze Zeit. Sprich: es wird übermalt. Manchmal verschwindet in dem angegebenen Bereich die obere der beiden verwendeten Grafiken.
Ich kann es nicht wirklich erklären, da ich es einfach nicht verstehe.Im Anhang sind zwei Dummygrafiken, die ich für eine genaue Nachstellung der Situation gemacht habe.
Im ersten Script benutze ich die Funktion am Anfang und erhalte den gewünschten Effekt.
Beispiel #1 - Funktioniert
[autoit]#NoTrayIcon
[/autoit] [autoit][/autoit] [autoit]
#include <GDIPlus.au3>
#include <WindowsConstants.au3>_GDIPlus_Startup ()
[/autoit] [autoit][/autoit] [autoit]
Opt ("GUIOnEventMode", 1)Global Const $i_WIDTH = 640, $i_HEIGHT = 680
[/autoit] [autoit][/autoit] [autoit]Global $h_Gui = GUICreate ("", $i_WIDTH, $i_HEIGHT)
[/autoit] [autoit][/autoit] [autoit]
Global $h_Input = GUICtrlCreateInput ("", 36, 623, 564, 14, Default, 0x00000020)Global $h_Graphic = _GDIPlus_GraphicsCreateFromHWND ($h_Gui)
[/autoit] [autoit][/autoit] [autoit]
Global $h_Bitmap = _GDIPlus_BitmapCreateFromGraphics ($i_WIDTH, $i_HEIGHT, $h_Graphic)
Global $h_Backbuffer = _GDIPlus_ImageGetGraphicsContext ($h_Bitmap)Global $h_Dummy1 = _GDIPlus_ImageLoadFromFile ('dummylayer1.png')
[/autoit] [autoit][/autoit] [autoit]
Global $h_Dummy2 = _GDIPlus_ImageLoadFromFile ('dummylayer2.png');GUICtrlSetState ($h_Input, 32) ; 32 == $GUI_HIDE
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsSetClipRect ($h_Backbuffer, 36, 623, 564, 14, 3)GUIRegisterMsg (0x000F, "WM_PAINT")
[/autoit] [autoit][/autoit] [autoit]
GUISetOnEvent (-3, "_Exit", $h_Gui)
GUISetOnEvent (-7, "_PrimaryDown", $h_Gui)
OnAutoItExitRegister ("_OnExit")
GUISetState (@SW_SHOW, $h_Gui)While Sleep (25)
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsClear ($h_Backbuffer, 0xFF00FF00)
_GDIPlus_GraphicsDrawImage ($h_Backbuffer, $h_Dummy1, 0, 0)
_GDIPlus_GraphicsDrawImage ($h_Backbuffer, $h_Dummy2, 0, 0)
_WinAPI_RedrawWindow ($h_Gui, 0, 0, $RDW_INTERNALPAINT)
WEndFunc _PrimaryDown ()
[/autoit] [autoit][/autoit] [autoit]
Local $a_Pos = GUIGetCursorInfo ($h_Gui)
If IsArray ($a_Pos) Then
Select
Case _InRect ($a_Pos, 36, 623, 564, 14)
;GUICtrlSetState ($h_Input, 16) ; 16 == $GUI_SHOW
;_GDIPlus_GraphicsSetClipRect ($h_Backbuffer, 36, 623, 564, 14, 3)
EndSelect
EndIf
EndFunc ;==> _PrimaryDownFunc _GDIPlus_GraphicsSetClipRect ($hGraphics, $nX, $nY, $nWidth, $nHeight, $iCombineMode = 0)
[/autoit] [autoit][/autoit] [autoit]
Local $aResult = DllCall ($ghGDIPDll, "uint", "GdipSetClipRect", "hwnd", $hGraphics, "float", $nX, "float", $nY, "float", $nWidth, "float", $nHeight, "int", $iCombineMode)
If @error Then Return SetError (@error, @extended, False)
$GDIP_STATUS = $aResult[0]
Return $aResult[0] = 0
EndFunc ;==> _GDIPlus_GraphicsSetClipRectFunc _InRect ($aPoint, $iXRect, $iYRect, $iWidthRect, $iHeightRect)
[/autoit] [autoit][/autoit] [autoit]
If $aPoint[0] >= $iXRect And $aPoint[1] >= $iYRect And $aPoint[0] <= $iXRect + $iWidthRect And $aPoint[1] <= $iYRect + $iHeightRect Then Return 1
Return 0
EndFunc ;==> _InRectFunc WM_PAINT ()
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsDrawImageRect ($h_Graphic, $h_Bitmap, 0, 0, $i_WIDTH, $i_HEIGHT)
EndFunc ;==> WM_PAINTFunc _Exit ()
[/autoit] [autoit][/autoit] [autoit]
Exit
EndFunc ;==> _ExitFunc _OnExit ()
[/autoit]
_GDIPlus_GraphicsDispose ($h_Graphic)
_GDIPlus_BitmapDispose ($h_Bitmap)
_GDIPlus_Shutdown ()
EndFunc ;==> _OnExit
In diesem Script will ich den Input erst beim Klick auf den hellblauen Bereich anzeigen lassen, was jedoch nicht klappt.Beispiel #2 - Funktioniert nicht
[autoit]#NoTrayIcon
[/autoit] [autoit][/autoit] [autoit]
#include <GDIPlus.au3>
#include <WindowsConstants.au3>_GDIPlus_Startup ()
[/autoit] [autoit][/autoit] [autoit]
Opt ("GUIOnEventMode", 1)Global Const $i_WIDTH = 640, $i_HEIGHT = 680
[/autoit] [autoit][/autoit] [autoit]Global $h_Gui = GUICreate ("", $i_WIDTH, $i_HEIGHT)
[/autoit] [autoit][/autoit] [autoit]
Global $h_Input = GUICtrlCreateInput ("", 36, 623, 564, 14, Default, 0x00000020)Global $h_Graphic = _GDIPlus_GraphicsCreateFromHWND ($h_Gui)
[/autoit] [autoit][/autoit] [autoit]
Global $h_Bitmap = _GDIPlus_BitmapCreateFromGraphics ($i_WIDTH, $i_HEIGHT, $h_Graphic)
Global $h_Backbuffer = _GDIPlus_ImageGetGraphicsContext ($h_Bitmap)Global $h_Dummy1 = _GDIPlus_ImageLoadFromFile ('dummylayer1.png')
[/autoit] [autoit][/autoit] [autoit]
Global $h_Dummy2 = _GDIPlus_ImageLoadFromFile ('dummylayer2.png')GUICtrlSetState ($h_Input, 32) ; 32 == $GUI_HIDE
[/autoit] [autoit][/autoit] [autoit]
;_GDIPlus_GraphicsSetClipRect ($h_Backbuffer, 36, 623, 564, 14, 3)GUIRegisterMsg (0x000F, "WM_PAINT")
[/autoit] [autoit][/autoit] [autoit]
GUISetOnEvent (-3, "_Exit", $h_Gui)
GUISetOnEvent (-7, "_PrimaryDown", $h_Gui)
OnAutoItExitRegister ("_OnExit")
GUISetState (@SW_SHOW, $h_Gui)While Sleep (25)
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsClear ($h_Backbuffer, 0xFF00FF00)
_GDIPlus_GraphicsDrawImage ($h_Backbuffer, $h_Dummy1, 0, 0)
_GDIPlus_GraphicsDrawImage ($h_Backbuffer, $h_Dummy2, 0, 0)
_WinAPI_RedrawWindow ($h_Gui, 0, 0, $RDW_INTERNALPAINT)
WEndFunc _PrimaryDown ()
[/autoit] [autoit][/autoit] [autoit]
Local $a_Pos = GUIGetCursorInfo ($h_Gui)
If IsArray ($a_Pos) Then
Select
Case _InRect ($a_Pos, 36, 623, 564, 14)
GUICtrlSetState ($h_Input, 16) ; 16 == $GUI_SHOW
_GDIPlus_GraphicsSetClipRect ($h_Backbuffer, 36, 623, 564, 14, 3) ; <== Funktioniert nicht so, wie geplant.
EndSelect
EndIf
EndFunc ;==> _PrimaryDownFunc _GDIPlus_GraphicsSetClipRect ($hGraphics, $nX, $nY, $nWidth, $nHeight, $iCombineMode = 0)
[/autoit] [autoit][/autoit] [autoit]
Local $aResult = DllCall ($ghGDIPDll, "uint", "GdipSetClipRect", "hwnd", $hGraphics, "float", $nX, "float", $nY, "float", $nWidth, "float", $nHeight, "int", $iCombineMode)
If @error Then Return SetError (@error, @extended, False)
$GDIP_STATUS = $aResult[0]
Return $aResult[0] = 0
EndFunc ;==> _GDIPlus_GraphicsSetClipRectFunc _InRect ($aPoint, $iXRect, $iYRect, $iWidthRect, $iHeightRect)
[/autoit] [autoit][/autoit] [autoit]
If $aPoint[0] >= $iXRect And $aPoint[1] >= $iYRect And $aPoint[0] <= $iXRect + $iWidthRect And $aPoint[1] <= $iYRect + $iHeightRect Then Return 1
Return 0
EndFunc ;==> _InRectFunc WM_PAINT ()
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsDrawImageRect ($h_Graphic, $h_Bitmap, 0, 0, $i_WIDTH, $i_HEIGHT)
EndFunc ;==> WM_PAINTFunc _Exit ()
[/autoit] [autoit][/autoit] [autoit]
Exit
EndFunc ;==> _ExitFunc _OnExit ()
[/autoit]
_GDIPlus_GraphicsDispose ($h_Graphic)
_GDIPlus_BitmapDispose ($h_Bitmap)
_GDIPlus_Shutdown ()
EndFunc ;==> _OnExitIch entschuldige mich für den unordentlichen Code. Habe da etwas herumgetestet... ~,~
Wäre nett, wenn jemand mal drüberschauen könnte... Ich verstehe es nämlich überhaupt nicht. -
[autoit]
;$i_Maximalwert = 100%
[/autoit][autoit][/autoit][autoit]
;$i_DerzeitigerWert = $i_X%$i_X = $i_DerzeitigerWert * 100 / $i_Maximalwert
[/autoit]Und $i_X setzt du dann bei jedem Schleifendurchgang mit GUICtrlSetData.
-
Der Code kommt mir doch irgendwie bekannt vor... <_<"
Spoiler anzeigen
[autoit]Global $a_Inhalt[9][4] = [ _
[/autoit] [autoit][/autoit] [autoit]
["Google", "Inhalt #1", "List3 #1", "www.google.de"], _
["Youtube", "Inhalt #2", "List3 #2", "www.youtube.com"], _
[3, "Inhalt #3", "List3 #3"], _
[4, "Inhalt #4", "List3 #4"], _
[5, "Inhalt #5", "List3 #5"], _
[6, "Inhalt #6", "List3 #6"], _
[7, "Inhalt #7", "List3 #7"], _
[8, "Inhalt #8", "List3 #8"], _
[9, "Inhalt #9", "List3 #9"]]$h_Gui = GUICreate ("", 650, 250)
[/autoit] [autoit][/autoit] [autoit]
$h_List1 = GUICtrlCreateList ("", 10, 10, 160, 160)
$h_List2 = GUICtrlCreateList ("", 180, 10, 160, 160)
$h_List3 = GUICtrlCreateList ("", 350, 10, 160, 160)For $i = 0 To UBound ($a_Inhalt) - 1
[/autoit] [autoit][/autoit] [autoit]
GUICtrlSetData ($h_List1, $a_Inhalt[$i][0])
Next$h_Go = GUICtrlCreateButton("Go", 10, 200, 50, 26)
[/autoit] [autoit][/autoit] [autoit]GUISetState (@SW_SHOW, $h_Gui)
[/autoit] [autoit][/autoit] [autoit]While True
[/autoit]
Switch GUIGetMsg ()
Case -3
Exit
Case $h_List1
$s_Read = GUICtrlRead ($h_List1)
For $i = 0 To UBound ($a_Inhalt) - 1
If $s_Read = $a_Inhalt[$i][0] Then
GUICtrlSetData ($h_List2, "")
GUICtrlSetData ($h_List2, $a_Inhalt[$i][1])
GUICtrlSetData ($h_List3, "")
GUICtrlSetData ($h_List3, $a_Inhalt[$i][2])
ExitLoop
EndIf
Next
Case $h_Go
$s_Read = GUICtrlRead ($h_List1)
For $i = 0 To UBound ($a_Inhalt) - 1
If $s_Read = $a_Inhalt[$i][0] Then ExitLoop ShellExecute ($a_Inhalt[$i][3])
Next
EndSwitch
WEnd -
Das ist eine sehr schöne Funktion und klappt soweit, so wie ich es mir wünsche.
Doch wie ist es, wenn ich die Buttons ausblenden will? In dem Bereich wird ja nicht mehr gezeichnet.
Wie kann ich es wieder 'unsetten'?€:
[autoit]$iCombineMode = 0
[/autoit]Das hätte ich mir durchlesen sollen. Sorry. .__.
Vielen Dank!

-
Guten Tag. ;D
Da ich ein ziemlicher Noob auf dem Bereich bin und hier sicher viele Kenner unterwegs sind, wollte ich mal etwas 'grundlegendes' fragen.
Also... Wie geht man am besten mit den Controls (Inputs, Buttons usw) um, wenn man gleichzeitig auf derselben Fläche (Hintergrund) Grafiken mit GDI+ zeichnet?Wenn ich die Controls direkt in der GUI erstelle, werden sie ja logischerweise übermalt.
Wenn ich sie aber auf einer bzw. mehreren Child-GUI's erstelle, dann verliert die Parent-GUI bei Eingaben ihren Fokus,
was unschön und ungünstig ist, weil der Parent in meinem Fall immer Events empfangen muss (Mausklicks u. ä.).Welche Lösungen gäbe es denn dafür?
LG
-
Naja ich arbeite seit fast einem Jahr mit Autoit und rufe Functions seit beginn mit call("") auf... Das hat bisher auch immer geklappt?!

Das klappt natürlich. Ist aber nicht wirklich sinnvoll.
Erstens ist es mehr "Schreibarbeit" und zweitens dauert die Ausführung viel länger.Hier mal ein Script zur Verdeutlichung:
Spoiler anzeigen
[autoit]Global $i_Timer
[/autoit] [autoit][/autoit] [autoit]$i_Timer = TimerInit ()
[/autoit] [autoit][/autoit] [autoit]
For $i = 1 To 100000
_foo ()
Next
$i_Timer = TimerDiff ($i_Timer)
ConsoleWrite ("Normal:" &@TAB& $i_Timer &@CRLF)$i_Timer = TimerInit ()
[/autoit] [autoit][/autoit] [autoit]
For $i = 1 To 100000
Call ("_foo")
Next
$i_Timer = TimerDiff ($i_Timer)
ConsoleWrite ("Call:" &@TAB& $i_Timer &@CRLF)Func _foo ()
[/autoit]
EndFunc -
Wieso übergibst du nicht einfach ein eindimensionales Array mit eindimensionalen Arrays...? Wäre doch ganz einfach.
-
Was genau klappt nicht? -_____-
-
Dein Problem ist wohl, dass du den Timer nicht zurücksetzt... Nehme ich mal an.
Spoiler anzeigen
[autoit]dim $checksum_koords [4]
[/autoit] [autoit][/autoit] [autoit]
$checksum_koords[0]=1002
$checksum_koords[1]=1070
$checksum_koords[2]=571
$checksum_koords[3]=581$Timer=TimerInit()
[/autoit] [autoit][/autoit] [autoit]
While 1
$checksum =PixelChecksum($window[0]+$checksum_koords[0],$window[1]+$checksum_koords[2], $window[0]+$checksum_koords[1],$window[1]+$checksum_koords[3])If TimerDiff($Timer) > 1000 Then
[/autoit]
$Timer=TimerInit()
If $checksum == PixelChecksum($window[0]+$checksum_koords[0],$window[1]+$checksum_koords[2], $window[0]+$checksum_koords[1],$window[1]+$checksum_koords[3]) Then
MsgBox(0,"","")
EndIf
EndIf
WEnd -
[autoit]
#include <File.au3>
[/autoit][autoit][/autoit][autoit]
#include <Array.au3>Global $s_From = @MyDocumentsDir, $s_To = @DesktopDir & "\Test", $i_Count
[/autoit][autoit][/autoit][autoit]
Global $a_File = _FileListToArray ($s_From, "*.jpg", 1)
If Not IsArray ($a_File) Then
Exit
ElseIf $a_File[0] < 10 Then
$i_Count = $a_File[0]
Else
$i_Count = 10
EndIfFor $i = 1 To $i_Count
[/autoit]
FileMove ($s_From & "\" & $a_File[$i], $s_To & "\" & $a_File[$i])
Next -
Es müsste so aussehen:
[autoit]ClipPut("")
[/autoit] -
[autoit]
GUICtrlSetBkColor (GUICtrlCreateGraphic (10, 10, 100, 100), $GUI_BKCOLOR_TRANSPARENT)
[/autoit]
; Die Konstante ist in GUIConstantsEx.au3 zu finden. -
Benutz
[autoit]GUICtrlCreateGraphic()
[/autoit]für die pseudo-Buttons.
-
Ich hätte nichts dagegen.

-
Spoiler anzeigen
[autoit]#include <GUIConstantsEx.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 623, 442, 192, 124)
GUISetState(@SW_SHOW)$link = GUICtrlCreateLabel("link here", 50, 30, 100)
[/autoit] [autoit][/autoit] [autoit]
GuiCtrlSetColor(-1,0x0000FF)
GUICtrlSetFont(-1, 11, 700,2, "Arial")
GuiCtrlSetCursor(-1,0)$bool = 0
[/autoit] [autoit][/autoit] [autoit]GUISetState(@SW_SHOW)
[/autoit] [autoit][/autoit] [autoit]#EndRegion ### END Koda GUI section ###
[/autoit] [autoit][/autoit] [autoit]While 1
[/autoit] [autoit][/autoit] [autoit]
_link()
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $link
shellExecute("http://www.youtube.com/watch?v=-XCbpBUXU0w")
EndSwitch
WEndFunc _link()
[/autoit]
$ret = GUIGetCursorInfo()
If $ret[4] = $link And Not $bool Then
$bool = 1
GUICtrlSetFont($link,8,400,4,"MS Sans Serif")
ElseIf $bool And Not ($ret[4]=$link) Then
$bool = 0
GUICtrlSetFont($link,8,400,0,"MS Sans Serif")
EndIf
endfunc -
Benutz den OnEventMode.
[autoit]
Opt ("GUIOnEventMode", 1)
[/autoit] -
[autoit]
TraySetIcon()
[/autoit]??
-
Meinst du so etwas?
Spoiler anzeigen
[autoit]Global $Formtop, $a_Checkbox[15], $a_Input[15], $ButtonOK, $ButtonCancel
[/autoit] [autoit][/autoit] [autoit]$Formtop = GUICreate("Punkte", 614, 447, 192, 122)
[/autoit] [autoit][/autoit] [autoit]
For $i = 0 To 14
$a_Checkbox[$i] = GUICtrlCreateCheckbox ("TOP "& $i + 1 &":", 16, 16 + ($i * 24), 54, 17)
$a_Input[$i] = GUICtrlCreateInput ("", 80, 16 + ($i * 24), 521, 21)
If $i > 0 Then GUICtrlSetState ($a_Checkbox[$i], 128)
Next$ButtonOK = GUICtrlCreateButton("Weiter", 80, 392, 137, 33)
[/autoit] [autoit][/autoit] [autoit]
$ButtonCancel = GUICtrlCreateButton("Abbrechen", 360, 392, 145, 33)
GUISetState(@SW_SHOW)While True
[/autoit]
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Exit
Case $ButtonCancel
Exit
Case $ButtonOK
$I1 = GUICtrlRead($a_Input[0])
$C1 = GUICtrlRead($a_Checkbox[0])
If $C1 = 1 Then
$TOP1 = (@CRLF & "TOP 1: " & $I1)
Else
$TOP1 = ("")
EndIf
$I2 = GUICtrlRead($a_Input[1])
$C2 = GUICtrlRead($a_Checkbox[1])
If $C2 = 1 Then
$TOP2 = (@CRLF & "TOP 2: " & $I2)
Else
$TOP2 = ("")
EndIf
$I3 = GUICtrlRead($a_Input[2])
$C3 = GUICtrlRead($a_Checkbox[2])
If $C3 = 1 Then
$TOP3 = (@CRLF & "TOP 3: " & $I3)
Else
$TOP3 = ("")
EndIf
GUIDelete($Formtop)
ExitLoop
EndSwitch
For $i = 0 To 14
If $nMsg = $a_Checkbox[$i] Then
If GUICtrlRead ($a_Checkbox[$i]) = 1 Then
GUICtrlSetState ($a_Checkbox[$i + 1], 64)
Else
For $j = $i + 1 To 14
GUICtrlSetState ($a_Checkbox[$j], 132)
Next
EndIf
EndIf
Next
WEndDu solltest dich wirklich mal mit Arrays auseinandersetzen. Es hilft ungemein.
Ah ja, falsch waren übrigens die Else-Abfragen.