Rawox Posted August 9, 2010 Share Posted August 9, 2010 Hi there, I'm trying whole day to create a giant crosshair all over my screen which is in fact the mouse so if the mouse moves the crosshair needs to move to, I wanted to create a cursor but Windows supports up to 32x32 pixels Anyone has another approach and can give me a little help in the right direction? Rawox Link to comment Share on other sites More sharing options...
seandisanti Posted August 10, 2010 Share Posted August 10, 2010 Hi there,I'm trying whole day to create a giant crosshair all over my screen which is in fact the mouse so if the mouse moves the crosshair needs to move to, I wanted to create a cursor but Windows supports up to 32x32 pixels Anyone has another approach and can give me a little help in the right direction? Rawoxyou could just have an image centered on your mouse position, and just move the image based on your mouse location Link to comment Share on other sites More sharing options...
Ascend4nt Posted August 10, 2010 Share Posted August 10, 2010 You can do it with GUI's Check out my CrossHairs (FullScreen) UDF. While the example creates an invisible cursor inside the full-screen crosshairs, I do have a function to change the system cursors to a mini-crosshair as well - use the function _MouseReplaceAllCursors() instead of _MouseHideAllCursors. My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
Rawox Posted August 10, 2010 Author Share Posted August 10, 2010 (edited) Thanks both cameronsdad and Ascend4nt, I think I'm gonna do it with GUI's. I'll check out the CrossHairs UDF. I can't use mouse cursor because Windows doesn't support cursors bigger than 32x32 pixels ' You'll hear from me Rawox UPDATE: Well, I've tried a few things and I'm so far right now: Only problem right now is that it does also capture the 'zoom window' and the crosshair, is there a way to have them not captured? expandcollapse popup;#NoTrayIcon #include <_CrossHairs.au3> #include <_MouseCursorFuncs.au3> #include <GDIPlus.au3> #include <ScreenCapture.au3> #include <WinAPI.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> Global $bHKPressed=False, $bPropertyHKPressed=False, $iResolutionchangeMsg=0 Global $hBMP, $hGUI1, $hGUI2, $hBitmap, $hGraphic1, $hGraphic2 Dim $MagWidth = 20, $MagHeight = 20, $MagZoom = 2 Dim $aNewMousePos _XHairInit(1,1) _XHairSetDisplayProps(1,1,0x000000) HotKeySet ( "{ESC}", "_exitProg" ) OnAutoItExitRegister ( "_exitProg" ) GUIRegisterMsg(0x007E,"_Resolutionchanged") _MouseHideAllCursors() $hGUI2 = GUICreate ("Zoomer", $MagWidth * $MagZoom + 2, $MagHeight * $MagZoom + 2, -1, -1, $WS_POPUP) GUISetBkColor ( 0x000000 ) GUISetState() _GDIPlus_Startup() While 1 $MousePos = MouseGetPos ( ) $hBMP = _ScreenCapture_Capture("", $MousePos[0], $MousePos[1], $MousePos[0]+$MagWidth, $MousePos[1]+$MagHeight, False) ; Initialize GDI+ library and load image $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBMP) ; Draw 2x zoomed image $hGraphic2 = _GDIPlus_GraphicsCreateFromHWND($hGUI2) _GDIPlus_GraphicsDrawImageRectRect($hGraphic2, $hBitmap, 0, 0, $MagWidth, $MagHeight, 1, 1, $MagWidth * $MagZoom, $MagHeight * $MagZoom) WinMove ( "Zoomer", "", $MousePos[0] + 20, $MousePos[1] + 20) If $iResolutionchangeMsg>=4 Then _XHairSetDisplayProps() $iResolutionchangeMsg=0 EndIf $aNewMousePos=MouseGetPos() _XHairShow($aNewMousePos[0],$aNewMousePos[1]) Sleep(5) WEnd Func _Resolutionchanged($hWnd,$iMsg,$wParam,$lParam) $iResolutionchangeMsg+=1 Return 'GUI_RUNDEFMSG' EndFunc Func _exitProg() GUIRegisterMsg(0x007E,"") ; WM_DISPLAYCHANGE 0x007E _XHairUnInit() _MouseRestoreAllCursors() _GDIPlus_GraphicsDispose($hGraphic2) _GDIPlus_ImageDispose($hBitmap) _WinAPI_DeleteObject($hBmp) _GDIPlus_Shutdown() Exit EndFunc Edited August 10, 2010 by Rawox Link to comment Share on other sites More sharing options...
Ascend4nt Posted August 10, 2010 Share Posted August 10, 2010 Move your Zoom window around so it doesn't get captured. As for the crosshairs being captured, that won't be a problem if you use regular GDI32 functions (rather than GDIPlus). There's some code on here somewhere on doing a zoom window with just GDI.. Of course, any partially-transparent window won't be captured in that case. If thats not a problem, do it with GDI32. If you *do* need transparency, well, you can't have the crosshairs without them being captured (unless you want to hide/show them each time you grab the screen). My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
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