Jump to content

ddraw.dll


 Share

Recommended Posts

Heading to bed, so I don't have time to do it myself:

Search for 'SetPixel' or maybe 'PixelSet'.

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

Sure, now that I have time :)

http://www.autoitscript.com/forum/index.ph...wtopic=8831&hl=

Not the best example, but it should get the job done. Any questions, feel free to ask.

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

Or... Here's a simpler example, with comments:

Func _PixelSet($WinHandle, $X, $Y, $Color)
    Local $WinHandle, $X, $Y, $Color, $dc
    $dc= DllCall ("user32.dll", "int", "GetDC", "hwnd", ($WinHandle)); get the window handles device context
    DllCall ("gdi32.dll", "long", "SetPixel", "long", $dc[0], "long", $x, "long", $y, "long", $color); the actuall 'SetPixel' function
    DllCall ("user32.dll", "int", "ReleaseDC", "hwnd", 0,  "int", $dc[0]); finally, realese the device context!
EndFunc

And here's a cool example :)

HotKeySet ("d", "Draw")
HotKeySet ("^e", "MyExit")
MsgBox (4096, "NOTE", "Press 'D' to draw and Ctrl+E to exit... The default color is Green.")
Func SetPixel ($handle, $x, $y, $color)
    $dc= DllCall ("user32.dll", "int", "GetDC", "hwnd", $handle)
    $setpixel= DllCall ("gdi32.dll", "long", "SetPixel", "long", $dc[0], "long", $x, "long", $y, "long", $color)
    $realesedc= DllCall ("user32.dll", "int", "ReleaseDC", "hwnd", 0,  "int", $dc[0])
EndFunc

Func Draw ()
    $pos= MouseGetPos ()
    SetPixel ("", $pos[0], $pos[1], 0x00FF00)
    Sleep (10)
EndFunc

Func MyExit ()
    Exit
    EndFunc

While 1
    Sleep (100)
    WEnd

Press "D" to draw anywhere, and press "E" to exit at anytime :D To get the dots off the screen, put something over them, like a window or something, or just refresh the screen :D

Edited by layer
FootbaG
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...