Jump to content

Recommended Posts

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 :lmao:
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 post
Share on other sites

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 :)

:lmao:o:)

Edited by layer
FootbaG
Link to post
Share on other sites

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 :)

:lmao:o:)

<{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 post
Share on other sites

haha, sucks for you two o:) i tryed creating it first... mwah ahahaha, the first time ive prooved you guys wrong :lmao: 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 by layer
FootbaG
Link to post
Share on other sites

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 :lmao::)

:)

EDIT: and yes, i do have the release DC and the setpixel calls in there o:)

Edited by layer
FootbaG
Link to post
Share on other sites

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 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 post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...