Darkxceed Posted September 23, 2011 Share Posted September 23, 2011 Hello all, I have a simple question I think because Im new to autoit. Still I have not found any clue on the internet how to do this. My code is: $dll = DllOpen("user32.dll") $result = DllCall($dll, "int", "BlockInput") = 1 $result = DllCall($dll, "int", "BlockInput") = 0 DllClose($dll) This gives an error when executed. Please tell me why? Btw i know autoit has the function(Blockinput(x)), but I want to know how to do this. gr, Bart Link to comment Share on other sites More sharing options...
Beege Posted September 23, 2011 Share Posted September 23, 2011 (edited) The correct format would be: $dll = DllOpen("user32.dll") $result = DllCall($dll, "BOOL", "BlockInput", "BOOL", 1) If @error Then ConsoleWrite('error' & @error & @LF) ConsoleWrite($result[0] & ' ' & _WinAPI_GetLastError() & @LF) The call completes ok on my pc, but I get "ERROR_ACCESS_DENIED 5 (0x5)" Returned from _WinAPI_GetLastError(). Might still work for you if your using xp. I'm puzzled here. Edited September 23, 2011 by Beege Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator Link to comment Share on other sites More sharing options...
Beege Posted September 23, 2011 Share Posted September 23, 2011 Figured it out. I needed to have admin rights. #Include <WinAPI.au3> #requireadmin $dll = DllOpen("user32.dll") $result = DllCall($dll, "BOOL", "BlockInput", "BOOL", 1) If @error Then ConsoleWrite('error' & @error & @LF) ConsoleWrite($result[0] & ' ' & _WinAPI_GetLastError() & @LF) Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator Link to comment Share on other sites More sharing options...
Darkxceed Posted September 26, 2011 Author Share Posted September 26, 2011 Hi Beege, thnx for the reply. The example you gave did not work. Getting "1 0" when executing. So no error but my mouse did not freeze. I tried: $dll = DllOpen("user32.dll") DllCall($dll, "BOOL", "BlockInput", "BOOL", 1) But that gave errors. Link to comment Share on other sites More sharing options...
bogQ Posted September 26, 2011 Share Posted September 26, 2011 (edited) on xp its working correctlyand its syntax is correct according tohttp://msdn.microsoft.com/en-us/library/ms646290(v=VS.85).aspxdid you add #requireadmin ? Edited September 26, 2011 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
Beege Posted September 26, 2011 Share Posted September 26, 2011 (edited) Did you add a sleep() to the end of the script to verify your mouse didnt freeze? If you ran only what I posted it would blockinput, then exit immediately. #Include <WinAPI.au3> #requireadmin $dll = DllOpen("user32.dll") $result = DllCall($dll, "BOOL", "BlockInput", "BOOL", 1) If @error Then ConsoleWrite('error' & @error & @LF) ConsoleWrite($result[0] & ' ' & _WinAPI_GetLastError() & @LF) sleep(10000) Edited September 26, 2011 by Beege Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator Link to comment Share on other sites More sharing options...
Darkxceed Posted October 4, 2011 Author Share Posted October 4, 2011 Did you add a sleep() to the end of the script to verify your mouse didnt freeze? If you ran only what I posted it would blockinput, then exit immediately. #Include <WinAPI.au3> #requireadmin $dll = DllOpen("user32.dll") $result = DllCall($dll, "BOOL", "BlockInput", "BOOL", 1) If @error Then ConsoleWrite('error' & @error & @LF) ConsoleWrite($result[0] & ' ' & _WinAPI_GetLastError() & @LF) sleep(10000) Ah sorry, didnt know that after the script has executed it returns back to '0', thanks for the help and time! 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