FrenchTroll Posted July 17, 2007 Share Posted July 17, 2007 Hello, Sorry for my english but i am french... I've got a problem with mousetrap on vista (test under a virtual machine) : If i trap the mouse on my session like that : _MouseTrap(100, 100) and i make a CTRL+ALT+DEL, the screen freeze and there's no possibity to return in the session (only shutdown the pc). I try to do that : While 1 Sleep(10) If ProcessExists("LogonUI.exe") Then _MouseTrap() EndIf Wend But it don't work. Have you got an idea ? THANKS Link to comment Share on other sites More sharing options...
SadBunny Posted July 17, 2007 Share Posted July 17, 2007 Hello, Sorry for my english but i am french... I've got a problem with mousetrap on vista (test under a virtual machine) : If i trap the mouse on my session like that : _MouseTrap(100, 100) and i make a CTRL+ALT+DEL, the screen freeze and there's no possibity to return in the session (only shutdown the pc). I try to do that : While 1 Sleep(10) If ProcessExists("LogonUI.exe") Then _MouseTrap() EndIf Wend But it don't work. Have you got an idea ? THANKS My first suggestion would be to try it on a real Vista machine, instead of a VM... I will now boot up Vista Business on my laptop and try CTRL+ALT+DEL after a mousetrap. Another question would be: why release the Mousetrap 100 times a second while a process is active (In your while loop.)? Maybe it's a CPU utilization problem in VM when doing that and starting the task manager at the same time? Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
FrenchTroll Posted July 17, 2007 Author Share Posted July 17, 2007 My first suggestion would be to try it on a real Vista machine, instead of a VM... I will now boot up Vista Business on my laptop and try CTRL+ALT+DEL after a mousetrap.I'm not sure of course but i think it's the same thing under a real machine...i hope you'll bring the answer Another question would be: why release the Mousetrap 100 times a second while a process is active (In your while loop.)? Maybe it's a CPU utilization problem in VM when doing that and starting the task manager at the same time?With the sleep(10) the CPU in low. And _Mousetrap() in the loop disable _Mousetrap(100, 100) (i think it's that ?)... Link to comment Share on other sites More sharing options...
SadBunny Posted July 17, 2007 Share Posted July 17, 2007 (edited) I'm not sure of course but i think it's the same thing under a real machine...i hope you'll bring the answer With the sleep(10) the CPU in low. And _Mousetrap() in the loop disable _Mousetrap(100, 100) (i think it's that ?)... It works without any trouble in my Vista: #include <Misc.au3> _MouseTrap(100,100) while 1 sleep(10) wend When I run this, my mouse is trapped. Then I press Ctrl+Alt+Del and the right screen comes up, the mouse is released and I can do what I want. If I make it: #include <Misc.au3> _MouseTrap(100, 100) While 1 Sleep(10) If ProcessExists("LogonUI.exe") Then _MouseTrap() EndIf WEnd Then it works just fine too, no problem whatsoever. But I do have higher CPU usage. And yes, _MouseTrap() releases the mouse, but you only need to call it ONCE to release it, calling it hundreds of times will not add anything except CPU usage (which might be low with the sleep but VM could still be unhappy). I would suggest to do it like this, and release the mouse ONCE, then re-trap it after LogonUI.exe stops (if you want to): #include <Misc.au3> _MouseTrap(100, 100) While 1 Sleep(10) If ProcessExists("LogonUI.exe") Then _MouseTrap(); <- release mousetrap ONCE While ProcessExists("LogonUI.exe") Sleep(10); <- wait for LogonUI.exe to stop WEnd _MouseTrap(100, 100); <- re-trap the mouse (if that's what you had planned) EndIf WEnd /edit: fixed code tag Edited July 17, 2007 by SadBunny Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
FrenchTroll Posted July 17, 2007 Author Share Posted July 17, 2007 Ok, thank you SadBunny Link to comment Share on other sites More sharing options...
SadBunny Posted July 17, 2007 Share Posted July 17, 2007 Ok, thank you SadBunny Well does it work better? Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
FrenchTroll Posted July 17, 2007 Author Share Posted July 17, 2007 Yes fine. But if i run taskmgr.exe the mousetrap stop working... I'm going to remove the additional tool (on virtual pc), it will be better Link to comment Share on other sites More sharing options...
SadBunny Posted July 17, 2007 Share Posted July 17, 2007 (edited) Yes fine. But if i run taskmgr.exe the mousetrap stop working... I'm going to remove the additional tool (on virtual pc), it will be better If I run taskmgr, the trap stops working for me too, on the real Vista machine. Seems taskmgr does that. Try including a check for the taskmgr process in the loop, if present, then wait until it has been closed again and re-trap the mouse. Not tested but maybe that would work. /edit: unless your idea is to not allow taskmgr access by the mousetrap... Then it seems you are in trouble under Vista /edit 2: tested it anyway. taskmgr.exe in XP does exactly the same thing. The following re-traps the mouse after taskmgr.exe exits... #include <Misc.au3> HotKeySet("{ESC}","bye") _MouseTrap(100,100) While 1 Sleep(10) If ProcessExists("taskmgr.exe") Then While ProcessExists("taskmgr.exe") Sleep(10) WEnd _MouseTrap(100,100) EndIf WEnd Func bye() _MouseTrap() Exit EndFunc Edited July 17, 2007 by SadBunny Roses are FF0000, violets are 0000FF... All my base are belong to you. 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