Christopher Blue Posted November 5, 2004 Author Share Posted November 5, 2004 How long should I sleep inbetween calls to ClipCursor() do you think? Link to comment Share on other sites More sharing options...
JSThePatriot Posted November 5, 2004 Share Posted November 5, 2004 Ah darn I guess I spoke too soon: the cursor's clipping area keeps getting reset. I will try to fix that somehow in my program.In the meantime, how can I use AutoIt to kill a process that doesn't have a window? (I start my MouseTrap.exe in hidden window mode).<{POST_SNAPBACK}>ProcessClose()JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
Christopher Blue Posted November 5, 2004 Author Share Posted November 5, 2004 ProcessClose()JS<{POST_SNAPBACK}>TY sir. I was looking for kill() or close() so no wonder I didn't find it. Link to comment Share on other sites More sharing options...
this-is-me Posted November 5, 2004 Share Posted November 5, 2004 I would sleep only as long as needed to keep the CPU from going haywire. Who else would I be? Link to comment Share on other sites More sharing options...
JSThePatriot Posted November 6, 2004 Share Posted November 6, 2004 I would sleep only as long as needed to keep the CPU from going haywire.<{POST_SNAPBACK}>In other words use a loop to loop through it and sleep at the bottom of the loop about Sleep(10) is what I have always been told.JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
Christopher Blue Posted November 6, 2004 Author Share Posted November 6, 2004 (edited) Here is my finished script and C++ programs:MouseTrapToggle.au3:Opt("WinTitleMatchMode", 3) Opt("MouseCoordMode", 0) $rest = 2147483647 $hotkey = "{F1}" $Trapped = 0 $MouseTrapFN = "MouseTrap.exe" $MouseUnTrapFN = "MouseUnTrap.exe" HotKeySet($hotkey, "ToggleTrap") While (1) Sleep($rest) WEnd Func ToggleTrap() If $Trapped Then ProcessClose($MouseTrapFN) Run($MouseUnTrapFN, "", @SW_HIDE) Else Run($MouseTrapFN, "", @SW_HIDE ) EndIf $Trapped = NOT $Trapped EndFuncMouseTrap.exe:#include <Windows.h> int main () { RECT rcClip; rcClip.left = 0; rcClip.top = 0; rcClip.right = 1024; rcClip.bottom = 768; ClipCursor(&rcClip); while (1) { Sleep(5); ClipCursor(&rcClip); } return 0; }MouseUnTrap.exe:#include <Windows.h> int main () { RECT rcClip; rcClip.left = 0; rcClip.top = 0; rcClip.right = 2048; rcClip.bottom = 768; ClipCursor(&rcClip); return 0; } Edited November 6, 2004 by Christopher Blue Link to comment Share on other sites More sharing options...
Guest Py7|-|[]/\/ Posted November 6, 2004 Share Posted November 6, 2004 Nice... What kind of hack/bot are you making for WCIII? Link to comment Share on other sites More sharing options...
Christopher Blue Posted November 6, 2004 Author Share Posted November 6, 2004 Py7|-|[]/\/: What I posted above is what I am making. Basically it makes Warcraft III playable in windowed mode which is a great boon since I am on dual monitors and the F1 hotkey lets me swing my mouse into the second monitor and surf or do whatever while there is a lapse in gameplay. Link to comment Share on other sites More sharing options...
Guest Py7|-|[]/\/ Posted November 6, 2004 Share Posted November 6, 2004 Thanks for clerifying that for me. Link to comment Share on other sites More sharing options...
Christopher Blue Posted November 6, 2004 Author Share Posted November 6, 2004 (edited) Here is the script to remove the borders (really really fucking cool...thanks Larry!). It then resizes the window to fit the desktop and moves it into the upper-left hand corner. It also uses a hotkey to allow quick hiding/unhiding of the window.Window Movement and Resize.au3:expandcollapse popup#include <GUIConstants.au3> Opt("WinTitleMatchMode", 3) Global $GWL_STYLE = -16 $window_name = "Warcraft III" $hidden = 0 $hotkey = "^q" $rest = 2147483647 HotKeySet($hotkey, "ToggleWindowHide") ;Remove the window borders $hWnd = WinGetHandle($window_name) $OldStyle = DLLCall( "user32.dll", "long", "GetWindowLong", "hwnd", $hWnd, "int", $GWL_STYLE ) If @error Then Exit $OldStyle = $OldStyle[0] $NewStyle = BitAND($OldStyle,BitNOT($WS_DLGFRAME) ) $NewStyle = BitAND($NewStyle,BitNOT($WS_THICKFRAME) ) $NewStyle = BitAND($NewStyle,BitNOT($WS_BORDER) ) DLLCall( "user32.dll", "long", "SetWindowLong", "hwnd", $hWnd, "int", $GWL_STYLE, "long", $NewStyle ) ; Move the Window into postion and resize it WinMove($window_name, "", 0, 0, 1024, 768) ; Wait for hotkey input while (1) Sleep ($rest) WEnd ; Hides/Unhides window Func ToggleWindowHide() If ($hidden) Then WinSetState ($window_name, "", @SW_SHOW) Else WinSetState ($window_name, "", @SW_HIDE) EndIf $hidden = NOT $hidden EndFuncBetween this script and the mouse clipping script, one can enjoy all of the advantages of full-screen mode *and* windowed mode! Edited November 6, 2004 by Christopher Blue Link to comment Share on other sites More sharing options...
Christopher Blue Posted November 6, 2004 Author Share Posted November 6, 2004 Thanks Larry. Here is the newly simplified version ofMouseUnTrap.cpp#include <Windows.h> int main () { ClipCursor(NULL); return 0; } 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