layer Posted January 29, 2005 Share Posted January 29, 2005 hey folks, i got the API SetPixel working!!! im really excited but i need to know how to make the SetPixel only apply for a certain control? is this possible? i hope so FootbaG Link to comment Share on other sites More sharing options...
layer Posted January 30, 2005 Author Share Posted January 30, 2005 from what i see, that only gets the DC of a window, not a control... is there something i missed? thanks for the help -layer FootbaG Link to comment Share on other sites More sharing options...
CyberSlug Posted January 30, 2005 Share Posted January 30, 2005 from what i see, that only gets the DC of a window, not a control... is there something i missed?thanks for the help-layer<{POST_SNAPBACK}>It's my understanding that "controls" are "windows." Keep this in mind when reading the Win32 API. Try it out Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
layer Posted January 30, 2005 Author Share Posted January 30, 2005 (edited) alright, i think i got it, but it's not working still... Global $draw $dc = DLLCall ("user32.dll", "int", "GetDC", "hwnd", $draw) $draw = GUICtrlCreateLabel("", 125, 215, 50, 50, $SS_SUNKEN) maybe i have to chnage the "hwnd" part to something else? could someone point me in the right direction? thanks Edited January 30, 2005 by layer FootbaG Link to comment Share on other sites More sharing options...
Valik Posted January 30, 2005 Share Posted January 30, 2005 alright, i think i got it, but it's not working still... Global $draw $dc = DLLCall ("user32.dll", "int", "GetDC", "hwnd", $draw) $draw = GUICtrlCreateLabel("", 125, 215, 50, 50, $SS_SUNKEN)maybe i have to chnage the "hwnd" part to something else? could someone point me in the right direction?thanks <{POST_SNAPBACK}>If there was a "Stop before you hurt yourself" emoticon, I would point you towards that. Seriously, what is your logic on how that code should work? How the hell do you get something's DC.... well, anything actually... without actually creating it first? Link to comment Share on other sites More sharing options...
layer Posted January 30, 2005 Author Share Posted January 30, 2005 (edited) haha, sucks for you two i tryed creating it first... mwah ahahaha, the first time ive prooved you guys wrong i just didnt post that code, but i just missed the part ControlGetHandle.. if i would known bout that.. i woudln't have asked this! thanks Edited January 30, 2005 by layer FootbaG Link to comment Share on other sites More sharing options...
Valik Posted January 30, 2005 Share Posted January 30, 2005 Then it shows how stupid you are if you posted dumb code like that when you knew it was wrong. Proud of yourself now? Link to comment Share on other sites More sharing options...
layer Posted January 30, 2005 Author Share Posted January 30, 2005 (edited) excuse me if i may be acting braindead to you guys... but this doesn't work:$draw = GUICtrlCreateLabel("", 125, 215, 50, 50, $SS_SUNKEN) $hwnd= ControlGetHandle ($main, "", $draw) $dc = DLLCall ("user32.dll", "int", "GetDC", "hwnd", $hwnd)ok, yell at me, curse at me, but only if you tell me why this doesnt work EDIT: and yes, i do have the release DC and the setpixel calls in there Edited January 30, 2005 by layer FootbaG Link to comment Share on other sites More sharing options...
CyberSlug Posted January 30, 2005 Share Posted January 30, 2005 (edited) Sigh. You have consistently offered code fragments devoid of any useful context information.Im taking bets if the bug is forgetting the array index on $dc Since you didn't even tell us what your DllCall to SetPixel looks like, I found this related thread so I could code the following example in about 10 seconds:EDIT: Well, Larry beat me to it.#include <GuiConstants.au3> $main = GuiCreate("blah") GuiSetState() $draw = GUICtrlCreateLabel("", 125, 215, 50, 50, $SS_SUNKEN) $hwnd= ControlGetHandle ($main, "", $draw) $dc = DLLCall ("user32.dll", "int", "GetDC", "hwnd", $hwnd) ; because it can be hard to see an individal pixel, lets draw a bunch $color = 0x0000FF;red For $xcoord = 1 to 10 For $ycoord = 1 to 10 DllCall("gdi32","long","SetPixel", "long", $dc[0], "long", $xcoord, "long", $ycoord, "long", $color) Next Next ;Don't forget to release: DLLCall("user32.dll","int","ReleaseDC","hwnd",0,"int",$dc[0]) While GuiGetMsg() <> $GUI_EVENT_CLOSE Wend Edited January 30, 2005 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
layer Posted January 30, 2005 Author Share Posted January 30, 2005 doh! i didnt have the realease DC after the loop... FootbaG Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now