Jump to content

send "1" or "0" to user32.DLL


Darkxceed
 Share

Recommended Posts

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

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. :graduated:

Edited by Beege
Link to comment
Share on other sites

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)
Link to comment
Share on other sites

on xp its working correctly

and its syntax is correct according to

http://msdn.microsoft.com/en-us/library/ms646290(v=VS.85).aspx

did you add #requireadmin ?

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
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

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 by Beege
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...