I'm trying to execute a code that draws an ellipse on screen by the mouse pointer every time I use ^LButton. The cool feature of this is I can just keep Control held down and click all over and draw a bunch of ellipses without having to release control every time. I want to take advantage of the control key so that when I finally release it my computer will press the PrintScreen key and take a screenshot of the screen, ellipses and all. The only issue is I can't get it to respond to the release of control, any ideas?
Here's the code that I'm using right now, in conjunction with the GDIP library and a tutorial I found online (Found at https://juho-lee.com/archive under "Other Useful Scripts #8 Draw Live on Screen"):
Code: Select all
;Draw ellipse
^LButton::
CoordMode, Mouse, Screen
while GetKeyState("LButton", "P") {
MouseGetPos, x1, y1
x1 -= 55
y1 -= 30
BitBlt(hdc3, 0, 0, Width, Height, hdc, 0, 0) ; save previous hdc first
MouseGetPos, x2, y2
x2 += 110
y2 += 60
Gdip_GraphicsClear(G2)
BitBlt(hdc2, 0, 0, Width, Height, hdc, 0, 0) ; BitBlt first before drawing
;seems to expect the (x,y) coordinates passed to always be the upper left corner and width,height to be positive
Gdip_DrawEllipse(G2, pPen, min(x1,x2), min(y1,y2), abs(x2-x1), abs(y2-y1))
UpdateLayeredWindow(hwnd7, hdc2, 0, 0, Width, Height)
step:=["0x" LA ColorList[Handles[LH]],LT,"Gdip_DrawEllipse",min(x1,x2),min(y1,y2),abs(x2-x1),abs(y2-y1)]
steps.push(step)
BitBlt(hdc, 0, 0, Width, Height, hdc2, 0, 0) ;copy buffer to screen
UpdateLayeredWindow(hwnd7, hdc, 0, 0, Width, Height) ; now draw on screen
}
return