CLEO Help Disable input

CLEO related
Status
Not open for further replies.

Badonga

Active member
Joined
Aug 5, 2013
Messages
71
Reaction score
0
Hello, is it possible to disable input for 1 second using this API:

Code:
Private Declare Function BlockInput Lib "user32" (ByVal fBlock As Long) As Long
--
The BlockInput function blocks keyboard and mouse input events from reaching applications.
---
· fBlock
[in] Specifies the function's purpose. If this parameter is TRUE, keyboard and mouse input events are blocked. If this parameter is FALSE, keyboard and mouse events are unblocked. Note that only the thread that blocked input can successfully unblock input.

I want an example. Disable input for 1 second and then enable it again. Thanks. I hope it is possible. :looky:
 

T3KTONIT

Well-known member
Joined
Sep 2, 2013
Messages
308
Reaction score
5
PHP:
// Used like this in VB: 

dim result as long = BlockInput(TRUE)

i'l have you reminded that this is Visual basic code...
but you can execute it in CLEO as well using 0AA5: call opcode.
 

Badonga

Active member
Joined
Aug 5, 2013
Messages
71
Reaction score
0
TH3RM4L link said:
I don't even understand what the hell you want :dont_care:

You know, use that API in cleo. Like this (not this api, just an example of what I want)

Code:
if 0AA2: 2@ = load_library "User32.dll"
then
     if 0AA4: 2@ = get_proc_address "keybd_event" library 2@
     then
         0AA5: call 2@ num_params 4 pop 0 0 0 0 0@
         wait 1@
         0AA5: call 2@ num_params 4 pop 0 0 0x02 0 0@
     end
end

I want you to use the API in the first post to block input for 1 second and then enable it again (in CLEO script).
 

Badonga

Active member
Joined
Aug 5, 2013
Messages
71
Reaction score
0
T3K link said:
i'l have you reminded that this is Visual basic code...
but you can execute it in CLEO as well using 0AA5: call opcode.

Yeah, I don't know how so I'm asking for pro's help here.  :computer_guy:
 

T3KTONIT

Well-known member
Joined
Sep 2, 2013
Messages
308
Reaction score
5
Badonga link said:
Yeah, I don't know how so I'm asking for pro's help here.  :computer_guy:
Code:
if 0AA2: 2@ = load_library "User32.dll"
then
     if 0AA4: 2@ = get_proc_address "BlockInput" library 2@
     then
         0AA5: call 2@ num_params 1 pop 1 0@
         wait 1@
         0AA5: call 2@ num_params 1 pop 0 0@
     end
end
 

Badonga

Active member
Joined
Aug 5, 2013
Messages
71
Reaction score
0
T3K link said:
Code:
if 0AA2: 2@ = load_library "User32.dll"
then
     if 0AA4: 2@ = get_proc_address "BlockInput" library 2@
     then
         0AA5: call 2@ num_params 1 pop 1 0@
         wait 1@
         0AA5: call 2@ num_params 1 pop 0 0@
     end
end

Thanks mate, but it doesn't work, and it gives this opcode error:
UnN3ad4.png


T3K link said:
But why do you want to block the input for 1 second? and enable it again? isn't that useless?.

I am making something which this thing is absolutely necessary. On the other side, I want to learn too.  :dont_care:
 

m1zg4rd_PL

Well-known member
Joined
Jul 19, 2013
Messages
222
Reaction score
0
Weird, but this is working for me:

Code:
{$CLEO}

thread "NameYourPry"

while true  
  repeat
    wait 0
  until key_down 50

  0AA2: 2@ = load_library "User32.dll"
  0AA4: 2@ = get_proc_address "BlockInput" library 2@
  0AA5: call 2@ num_params 1 pop 0 1
  print "Input blocked" 1000
  wait 1000
  print "Input allowed" 1000
  0AA5: call 2@ num_params 1 pop 0 0
  0AA3: free_library 2@

  repeat
    wait 0
  until key_up 50
end
 

Badonga

Active member
Joined
Aug 5, 2013
Messages
71
Reaction score
0
m1zg4rd link said:
Weird, but this is working for me:

Code:
{$CLEO}

thread "NameYourPry"

while true  
  repeat
    wait 0
  until key_down 50

  0AA2: 2@ = load_library "User32.dll"
  0AA4: 2@ = get_proc_address "BlockInput" library 2@
  0AA5: call 2@ num_params 1 pop 0 1
  print "Input blocked" 1000
  wait 1000
  print "Input allowed" 1000
  0AA5: call 2@ num_params 1 pop 0 0
  0AA3: free_library 2@

  repeat
    wait 0
  until key_up 50
end

How come my compiler doesn't know what 'key_up' is....

85rNVrP.png
 

Badonga

Active member
Joined
Aug 5, 2013
Messages
71
Reaction score
0
Anyway it works, but not very good. Is it possible to make a working example without having to press a key or wait for key to be pressed?

Disable input for 1 second and enable it again.

I tried taking this part only but it is bugged (not working right - it loops like hell and never stop).

Code:
  0AA2: 2@ = load_library "User32.dll"
  0AA4: 2@ = get_proc_address "BlockInput" library 2@
  0AA5: call 2@ num_params 1 pop 0 1
  print "Input blocked" 1000
  wait 1000
  print "Input allowed" 1000
  0AA5: call 2@ num_params 1 pop 0 0
  0AA3: free_library 2@
 

m1zg4rd_PL

Well-known member
Joined
Jul 19, 2013
Messages
222
Reaction score
0
Just change "key_up 50" to "not key_down 50", I made this keyword because it's more readable...

Inside infinite "while true" you can see two repeat..until loops. First one wait until key is pressed, then call to function and wait until key is up in second repeat..until loop.
 

Badonga

Active member
Joined
Aug 5, 2013
Messages
71
Reaction score
0
m1zg4rd link said:
Just change "key_up 50" to "not key_down 50", I made this keyword because it's more readable...

Inside infinite "while true" you can see two repeat..until loops. First one wait until key is pressed, then call to function and wait until key is up in second repeat..until loop.

Look at this: It's not even working. I have no idea why.

Code:
{$CLEO}

thread "NameYourPry"

:X  
    wait 0
  if key_down 57
  then
  0AA2: 2@ = load_library "User32.dll"
  0AA4: 2@ = get_proc_address "BlockInput" library 2@
  0AA5: call 2@ num_params 1 pop 0 1
  print "Input blocked" 1000
  wait 1000
  print "Input allowed" 1000
  0AA5: call 2@ num_params 1 pop 0 0
  0AA3: free_library 2@
    end
goto @X

And even if there's no loop, that thing still loops even tho when you do it once.
 
Status
Not open for further replies.
Top