Re: Simple drawing question Autoit balks at : $hDC = $hDC[0]
"valery_vi" <[email protected]>
| Newsgroups | gmane.comp.windows.autoit.user |
|---|---|
| Message-ID | <[email protected]> |
File : /MISC/AClock.zip Uploaded by : valery_vi Description : AClock You can access this file at the URL: http://groups.yahoo.com/group/AutoItList/files/MISC/AClock.zip To learn more about file sharing for your group, please visit: http://help.yahoo.com/help/us/groups/files Regards, Valery --- In [email protected], "Joe" <yf777a@...> wrote: > > > I tried to run the Aclock script but AutoIt v3.2.4.9 > balks at lines like:$hDC = $hDC[0] > > When I comment them out the script runs, but nothing appears. > I tested in with a message box in the Paint functions. > > Thank you for any help. > -Joe > > --- In [email protected], "valery_vi" <shehrer1@> wrote: > > > > Someone from AutoItScript forum wrote: > > " > > I want to draw a box on my screen but i don't manage to make it > stay > > on the screen. When the box is finished drawind, it disappears ! > > > > What sould i do ? > > " > > > > This script works for me: > > #include <GUIConstants.au3> > > Global $user = DllOpen("user32.dll") > > Global $gdi = DllOpen("gdi32.dll") > > Global $hDC, $Pen > > > > $hWnd = GUICreate("box", 600, 400) > > $hDC = DllCall($user, "int", "GetDC", "hwnd", $hWnd) > > $hDC = $hDC[0] > > $Pen = DllCall($gdi, "int", "CreatePen", "int", 0, "int", 4, "int", > > 0x00AAFF) > > $Pen = $Pen[0] > > DllCall($gdi, "int", "SelectObject", "int", $hDC, "int", $Pen) > > > > GUISetState(@SW_SHOW) > > > > $x1 = 10 > > $x2 = 590 > > $y1 = 10 > > $y2 = 390 > > DrawBox($x1, $y1, $x2, $y2) > > > > While 1 > > $Msg = GUIGetMsg() > > if $Msg = $GUI_EVENT_CLOSE then ExitLoop > > WEnd > > > > DllCall($user, "int", "ReleaseDC", "hwnd", 0, "int", $hDC) > > DllClose($user) > > DllClose($gdi) > > > > Func DrawBox($x1, $y1, $x2, $y2) > > if $x1 = '' or $x2 = '' then return > > DllCall($gdi, "int", "MoveToEx", "hwnd", $hDC, "int", $x1, "int", > > $y1, "int", 0) > > DllCall($gdi, "int", "LineTo", "hwnd", $hDC, "int", $x1, "int", $y2) > > DllCall($gdi, "int", "LineTo", "hwnd", $hDC, "int", $x2, "int", $y2) > > DllCall($gdi, "int", "LineTo", "hwnd", $hDC, "int", $x2, "int", $y1) > > DllCall($gdi, "int", "LineTo", "hwnd", $hDC, "int", $x1, "int", $y1) > > EndFunc > > > > Valery > > >