Sign in to follow this  
Followers 0
Darkxceed

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

7 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (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. :graduated:

Edited by Beege

Share this post


Link to post
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)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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.

 

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 by Beege

Share this post


Link to post
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!

Share this post


Link to post
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
Sign in to follow this  
Followers 0