Hallo,
kann man irgendwie die Farbe eines Pixels ändern, bzw. bestimmen? Z. B. Solange das Skript läuft soll der Pixel was-weiß-ich immer die Farbe rot haben.
Ich habe nur gefunden in der Hilfe das man die farbe auslesen kann etc.
danke und Gruß
Pixelfabre bestimmen?
-
- [ gelöst ]
-
Vaerldskrig -
9. Januar 2010 um 11:21 -
Geschlossen -
Erledigt
-
-
Du kannst eine GUI mit entsprechender Größe erstellen und ihr dann eine Hintergrundfarbe zuweisen:
Spoiler anzeigen
[autoit]
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>GUICreate("Test", 1, 1, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, $WS_POPUPWINDOW, $WS_EX_TOOLWINDOW)
[/autoit] [autoit][/autoit] [autoit][/autoit]
$deinefarbe = 0xFF0000
GUISetBkColor($deinefarbe)
GUISetState()
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
GUIDelete()
Exit -
den gedanken mit der GUI hatte ich auch scohn, aber weiß nicht. Auf jeden fall siehts nicht mal so dumm aus. danke erstmal.
aber das blöde ist eben das es eben in hintergrund gerät wenn man ein anderes fenster aktiv hat etc... -
[autoit]
WinSetOnTop
[/autoit] -
um Pixel an einer bestimmten Position zu setzen verwende ich gerne
[autoit]#include <WindowsConstants.au3>
[/autoit][autoit][/autoit][autoit]
#include <WinAPI.au3>
HotKeySet("{ESC}","_exit")Local $hDC, $hPen, $obj_orig
[/autoit][autoit][/autoit][autoit]
$hDC = _WinAPI_GetWindowDC(0) ; DC of entire screen (desktop)
$hPen = _WinAPI_CreatePen($PS_SOLID, 1, 0x0000FF)
$obj_orig = _WinAPI_SelectObject($hDC, $hPen)while 1
[/autoit][autoit][/autoit][autoit]
$x1=random(1,@DesktopWidth,1)
$y1=random(1,@Desktopheight,1)
_WinAPI_DrawLine($hDC, $X1, $Y1, $X1+1, $Y1+1)
wendfunc _exit()
[/autoit]
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)
; clear resources
_WinAPI_SelectObject($hDC, $obj_orig)
_WinAPI_DeleteObject($hPen)
_WinAPI_ReleaseDC(0, $hDC)
exit
endfunc -
Ich danke euch beiden.
Andy, deins war das was ich wollte
Gruß -
Ich hab mal sowas hier gemacht... UNd funzt auch eig ganz gut
[autoit]$Color = 0x0000FF
[/autoit][autoit][/autoit][autoit]
$Handle = "$WS_EX_TOPMOST"$x1 = 639
[/autoit][autoit][/autoit][autoit]
$y1 = 399
$x2 = 640
$y2 = 399
$x3 = 641
$y3 = 399
$x4 = 639
$y4 = 400
$x5 = 640
$y5 = 400
$x6 = 641
$y6 = 400
$x7 = 639
$y7 = 401
$x8 = 640
$y8 = 401
$x9 = 641
$y9 = 401While 1
[/autoit]
$GetDC = DllCall ("user32.dll", "int", "GetDC", "hwnd", $Handle)
$SetPixel1 = DllCall ("gdi32.dll", "long", "SetPixel", "long", $GetDC[0], "long", $x1, "long", $y1, "long", $Color)
$SetPixel2 = DllCall ("gdi32.dll", "long", "SetPixel", "long", $GetDC[0], "long", $x2, "long", $y2, "long", $Color)
$SetPixel3 = DllCall ("gdi32.dll", "long", "SetPixel", "long", $GetDC[0], "long", $x3, "long", $y3, "long", $Color)
$SetPixel4 = DllCall ("gdi32.dll", "long", "SetPixel", "long", $GetDC[0], "long", $x4, "long", $y4, "long", $Color)
$SetPixel5 = DllCall ("gdi32.dll", "long", "SetPixel", "long", $GetDC[0], "long", $x5, "long", $y5, "long", $Color)
$SetPixel6 = DllCall ("gdi32.dll", "long", "SetPixel", "long", $GetDC[0], "long", $x6, "long", $y6, "long", $Color)
$SetPixel7 = DllCall ("gdi32.dll", "long", "SetPixel", "long", $GetDC[0], "long", $x7, "long", $y7, "long", $Color)
$SetPixel8 = DllCall ("gdi32.dll", "long", "SetPixel", "long", $GetDC[0], "long", $x8, "long", $y8, "long", $Color)
$SetPixel9 = DllCall ("gdi32.dll", "long", "SetPixel", "long", $GetDC[0], "long", $x9, "long", $y9, "long", $Color)
$ReleaseDC = DllCall ("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $GetDC[0])
WEndGruß AndyTR
-
Ich hab mal sowas hier gemacht... UNd funzt auch eig ganz gut
Kanns leider nicht testen - bin grad am Netbook ohne AutoIt.
Aber so ist dein script um einiges kürzer:Spoiler anzeigen
[autoit]$Color = 0x0000FF
[/autoit]
$Handle = "$WS_EX_TOPMOST"
Dim $Coord[8][2] = [[639,399],[640,399],[641,399],[639,400],[640,400],[641,400],[639,401],[640,401],[641,401]]
Dim $SetPixel[8]
While 1 * sleep(20)
$GetDC = DllCall ("user32.dll", "int", "GetDC", "hwnd", $Handle)
For $i = 0 to 8
$SetPixel[$i] = DllCall ("gdi32.dll", "long", "SetPixel", "long", $GetDC[0], "long", $Coord[$i][0], "long", $Coord[$i][1], "long", $Color)
Next
$ReleaseDC = DllCall ("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $GetDC[0])
WEnd -
AndyTR Ja, ddeins funktioniert auch sehr gut, danke.
@ Seubo deins bringt bei mir einen fehler:
C:\Dokumente und Einstellungen\...\...\***.au3 (3) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
Dim $Coord[8][2] = [[639,399],[640,399],[641,399],[639,400],[640,400],[641,400],[639,401],[640,401],[641,401]]
Dim $Coord[8][2] = [[639,399],[640,399],[641,399],[639,400],[640,400],[641,400],[639,401],[640,401],[^ ERROR
>Exit code: 1 Time: 0.336 -
Dann versuch mal:
Spoiler anzeigen
[autoit]$Color = 0x0000FF
[/autoit]
$Handle = "$WS_EX_TOPMOST"
Dim $Coord[9][2] = [[639,399],[640,399],[641,399],[639,400],[640,400],[641,400],[639,401],[640,401],[641,401]]
Dim $SetPixel[9]
While 1 * sleep(20)
$GetDC = DllCall ("user32.dll", "int", "GetDC", "hwnd", $Handle)
For $i = 0 to 9
$SetPixel[$i] = DllCall ("gdi32.dll", "long", "SetPixel", "long", $GetDC[0], "long", $Coord[$i][0], "long", $Coord[$i][1], "long", $Color)
Next
$ReleaseDC = DllCall ("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $GetDC[0])
WEnd