Zinefer Posted December 25, 2008 Posted December 25, 2008 (edited) I am trying to create a second mouse pointer using GDI. I found some crosshair code and modified it a bit to follow the mouse around. However, instead of it just moving around it kindof paints across myscreen until something refreshed it. I have tried everything I can think of to cause the screen to refresh but, to no avail. Please, let me know if you have any ideas! c Thanks so much. Here is my code: while 1 $pos = MouseGetPos() pict($pos[0]+20, $pos[1]) sleep(2) WEnd Func drawpix($dc,$x,$y,$color) DllCall ("gdi32.dll", "long", "SetPixel", "long", $dc[0], "long", $x, "long", $y, "long", $color) EndFunc Func pict($x,$y) $dc= DllCall ("user32.dll", "int", "GetDC", "hwnd", "") drawpix($dc,$x-4+1,$y-4+1,0x000000FF) drawpix($dc,$x-4+1,$y-4+2,0x000000FF) drawpix($dc,$x-4+1,$y-4+6,0x000000FF) drawpix($dc,$x-4+1,$y-4+7,0x000000FF) drawpix($dc,$x-4+2,$y-4+1,0x000000FF) drawpix($dc,$x-4+2,$y-4+7,0x000000FF) drawpix($dc,$x-4+3,$y-4+3,0x000000FF) drawpix($dc,$x-4+3,$y-4+5,0x000000FF) drawpix($dc,$x-4+4,$y-4+4,0x00000000) drawpix($dc,$x-4+5,$y-4+3,0x000000FF) drawpix($dc,$x-4+5,$y-4+5,0x000000FF) drawpix($dc,$x-4+6,$y-4+1,0x000000FF) drawpix($dc,$x-4+6,$y-4+7,0x000000FF) drawpix($dc,$x-4+7,$y-4+1,0x000000FF) drawpix($dc,$x-4+7,$y-4+2,0x000000FF) drawpix($dc,$x-4+7,$y-4+6,0x000000FF) drawpix($dc,$x-4+7,$y-4+7,0x000000FF) DllCall ("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $dc[0]) ;DllCall("gdi32.dll", "int", "DeleteDC", "hwnd", $dc) EndFunc Edited December 25, 2008 by Zinefer
FireFox Posted December 25, 2008 Posted December 25, 2008 @Zinefer You can try to create transparent window with Icon on it
Zinefer Posted December 25, 2008 Author Posted December 25, 2008 Actually, i'm really just wanting a way to refresh the part of the screen I just drew to. There has to be a way.
monoceres Posted December 25, 2008 Posted December 25, 2008 Actually, i'm really just wanting a way to refresh the part of the screen I just drew to. There has to be a way.Check out _WinAPI_RedrawWindow Broken link? PM me and I'll send you the file!
Zinefer Posted December 25, 2008 Author Posted December 25, 2008 This seems like it would work. However, I am unable to leave the HWND parameter optional. I am currently writing to the desktop window.... Any ideas?
FireFox Posted December 25, 2008 Posted December 25, 2008 @Zinefer Are you sure you dont want to do transparent window ? All ctrl on it will be visible like desktop window) _WinAPI_SetLeyeredWindowAttributes
Zinefer Posted December 25, 2008 Author Posted December 25, 2008 Yeah, I would like to do it this way, but if I am unable I can resort to that method. I am sure there is a way to do this I am just doing something wrong.
Zinefer Posted December 25, 2008 Author Posted December 25, 2008 I just tried your suggestion. It doesn't work for my application because it will alter the window orders. Anyone, if you know how to do this I would greatly appreciate suggestions.
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