James Posted May 2, 2008 Share Posted May 2, 2008 Hi all, I am in need some of help please. I need to know how to make my script change cursor when the Window Handle (The top of a window is held) to the Move cursor (all four arrows are shown). I found Smoke_N's SetCursor however that permantlety changes it. Thanks, James Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
DaRam Posted May 2, 2008 Share Posted May 2, 2008 (edited) Hi all,I am in need some of help please.I need to know how to make my script change cursor when the Window Handle (The top of a window is held) to the Move cursor (all four arrows are shown). I found Smoke_N's SetCursor however that permantlety changes it.Thanks,JamesNot very efficient, but you would check for a $GUI_EVENT_PRIMARYDOWN and call GUISetCursor(9) ; = SIZEALL, plus on $GUI_EVENT_PRIMARYUP setit back to Normal with GUISetCursor(0).Edit: Don't bother, this only works when clicking within the GUI not the Titlebar itself :-( But you get the idea. Edited May 2, 2008 by DaRam Link to comment Share on other sites More sharing options...
monoceres Posted May 2, 2008 Share Posted May 2, 2008 Not very efficient, but you would check for a $GUI_EVENT_PRIMARYDOWN and call GUISetCursor(9) ; = SIZEALL, plus on $GUI_EVENT_PRIMARYUP setit back to Normal with GUISetCursor(0).That won't work since GUISetCursor only change the cursor inside the window not in the title bar (or something), also $WM_MOVE should be used to check if the window is moving Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
MikeP Posted May 3, 2008 Share Posted May 3, 2008 almost working.. I'm posting it if you wanna dig the idea.. too tired to finish : #Include <Misc.au3> #Include <WinAPI.au3> HotKeySet("{PAUSE}","QuitIt") $titlebarheight = 20 $pressed = False $dll = DllOpen("user32.dll") While 1 If _IsPressed("01", $dll) Then $pressed = true $mousepos = MouseGetPos() $handle = WinGetHandle("") $title = WinGetTitle("") $size = WinGetClientSize("") $pos = WinGetPos("") If StringCompare($title,"Program Manager") AND $mousepos[0] > $pos[0] AND $mousepos[0] < $pos[0]+$size[0] AND $mousepos[1] > $pos[1] AND $mousepos[1] < $pos[1]+$titlebarheight Then MouseMove($mousepos[0], $mousepos[1], 0) $loadcurs = DllCall("user32.dll", "hwnd", "LoadCursor", "hwnd", 0, 'int', 32512) $syscurs = DllCall("user32.dll", "int", "SetSystemCursor", "int", $loadcurs[0], "int", 32646) EndIf EndIf If $pressed Then $loadcurs = DllCall("user32.dll", "hwnd", "LoadCursor", "hwnd", 0, 'int', 32646) $syscurs = DllCall("user32.dll", "int", "SetSystemCursor", "int", $loadcurs[0], "int", 32512) $pressed = False EndIf Sleep(10) WEnd if your pointer is fucked up.. go to your Mouse config, pointer tab and clic OK to get the standard pointers back. Link to comment Share on other sites More sharing options...
rasim Posted May 3, 2008 Share Posted May 3, 2008 More solutions: expandcollapse popup#include <GuiConstants.au3> #include <Misc.au3> ;Global Const $HTCAPTION = 0x2 Global Const $OCR_ARROW = 32512 Global Const $OCR_SIZEALL = 32646 Global $flag = False Global $DllHandle = DllOpen("user32.dll") $hGui = GUICreate("Test", 300, 200) GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUISetState() Do Until GUIGetMsg() = -3 DllClose($DllHandle) Func WM_NCHITTEST($hWnd, $Msg, $wParam, $lParam) Local $iProc $iProc = DllCall($DllHandle, "int", "DefWindowProc", "hwnd", $hWnd, "int", $Msg, "wparam", $wParam, "lparam", $lParam) $iProc = $iProc[0] If ($iProc = $HTCAPTION) And (_IsPressed("01", $DllHandle) = 1) And ($flag = False) Then $flag = True _SetCursor($OCR_SIZEALL, $OCR_ARROW) ElseIf (_IsPressed("01", $DllHandle) = 0) And ($flag = True) Then $flag = False _SetCursor($OCR_ARROW, $OCR_SIZEALL) DllCall($DllHandle, "int", "ShowCursor", "int", False) DllCall($DllHandle, "int", "ShowCursor", "int", True) EndIf Return $GUI_RUNDEFMSG EndFunc Func _SetCursor($sNewCursor, $sReplaceCursor) Local $hCursor = DllCall("user32.dll", "hwnd", "LoadCursor", "hwnd", 0, "int", $sNewCursor) $hCursor = $hCursor[0] DllCall($DllHandle, "int", "SetSystemCursor", "hwnd", $hCursor, "int", $sReplaceCursor) DllCall($DllHandle, "int", "DestroyCursor", "hwnd", $hCursor) EndFunc Link to comment Share on other sites More sharing options...
Kip Posted May 3, 2008 Share Posted May 3, 2008 (edited) i already asked that +solution on the last page:http://www.autoitscript.com/forum/index.ph...=Cursor++Window Edited May 3, 2008 by kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
MikeP Posted May 3, 2008 Share Posted May 3, 2008 I think the thread creator wanted it to work on any window "I need to know how to make my script change cursor when the Window Handle (The top of a window is held)". Your code works only within a GUI.. any idea to get it to work on any window? Link to comment Share on other sites More sharing options...
James Posted May 3, 2008 Author Share Posted May 3, 2008 Correct, I need it to work with any windows. Sorry I should have mentioned that before. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
James Posted May 3, 2008 Author Share Posted May 3, 2008 I have tried to use the DLL calls to work with any windows however the WM_NCHITTEST function rasim supplied requires parameters which I don't know what should be. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
James Posted May 4, 2008 Author Share Posted May 4, 2008 I'm stumped. BUMP (Wow, I haven't bumped anything in ages). Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
James Posted May 7, 2008 Author Share Posted May 7, 2008 Guess no-one knows. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
BrettF Posted May 7, 2008 Share Posted May 7, 2008 Read up on where the function is being called, and ye' shall find ye' answer... Hint, look at GUIRegisterMsg... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
torels Posted May 7, 2008 Share Posted May 7, 2008 Suggestion: get the position of each window with winlist and wingetpos functions and then use Func _SetCursor($sNewCursor, $sReplaceCursor) Local $hCursor = DllCall("user32.dll", "hwnd", "LoadCursor", "hwnd", 0, "int", $sNewCursor) $hCursor = $hCursor[0] DllCall($DllHandle, "int", "SetSystemCursor", "hwnd", $hCursor, "int", $sReplaceCursor) DllCall($DllHandle, "int", "DestroyCursor", "hwnd", $hCursor) EndFunc when the cursor is on the first 10px of the window and switch back again when it is out of the 10 px Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org Link to comment Share on other sites More sharing options...
James Posted May 7, 2008 Author Share Posted May 7, 2008 Bert, I have just been looking for GUIRegisterMsg on non-AutoIt windows. Torels, that is a really good idea. I shall try it now Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
torels Posted May 7, 2008 Share Posted May 7, 2008 is ti working ? Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org Link to comment Share on other sites More sharing options...
James Posted May 7, 2008 Author Share Posted May 7, 2008 Sort of. I'm getting there. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
torels Posted May 7, 2008 Share Posted May 7, 2008 OK Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org 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