Sign in to follow this  
Followers 0
Zinefer

Decoy Mouse Pointer

8 posts in this topic

#1 ·  Posted (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 by Zinefer

Share this post


Link to post
Share on other sites



@Zinefer

You can try to create transparent window with Icon on it :)


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

@Zinefer

Are you sure you dont want to do transparent window ? All ctrl on it will be visible like desktop window)

_WinAPI_SetLeyeredWindowAttributes


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


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
Sign in to follow this  
Followers 0