Jump to content

How do you unregister a hotkey


Recommended Posts

HotKeySet("{Esc}")

; capture and pass along a keypress
[/color][i][color="#000000"]HotKeySet[/color][color="#000000"]("{Esc}",  "captureEsc")
Func captureEsc()
    ; ... can do stuff here
    [/color][color="#000000"]HotKeySet[/color][color="#000000"]("{Esc}")
     Send("{Esc}")
    [/color][color="#000000"]HotKeySet[/color][color="#000000"]("{Esc}", "captureEsc")
EndFunc

8)

without the use of hotkeyset() 8-)
[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
Link to comment
Share on other sites

without the use of hotkeyset() 8-)

example,

$a = 0x30 ;"A"

DllCall("user32.dll", "short", "RegisterHotKey", "hwnd", $hWnd, "int", "1337" & Dec($a) , "uint", 0x0001, "uint", $a)

DllCall("user32.dll", "short", "UnRegisterHotKey", "hwnd", $hWnd, "int", "1337" & hex($a) , "uint", 0x0001, "uint", $a)

Edit~

chit, sorry for DP

am reading http://www.dotnet2themax.com/ShowContent.a...10-c2bb7075ba78

Edited by ReaImDown
[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
Link to comment
Share on other sites

example,

$a = 0x30 ;"A"

DllCall("user32.dll", "short", "RegisterHotKey", "hwnd", $hWnd, "int", "1337" & Dec($a) , "uint", 0x0001, "uint", $a)

DllCall("user32.dll", "short", "UnRegisterHotKey", "hwnd", $hWnd, "int", "1337" & hex($a) , "uint", 0x0001, "uint", $a)

Edit~

chit, sorry for DP

am reading http://www.dotnet2themax.com/ShowContent.a...10-c2bb7075ba78

bumpy

[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
Link to comment
Share on other sites

  • Moderators

I haven't looked on msdn to see if you are even calling it correctly... but why are you passing a string to an integer in that call (the hex).

Edit:

Did you even look at MSDN?

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

It only has 2 params.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I haven't looked on msdn to see if you are even calling it correctly... but why are you passing a string to an integer in that call (the hex).

Edit:

Did you even look at MSDN?

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

It only has 2 params.

I tried everything and I cannot unregister a hotkey...anyone have any idea's?

[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
Link to comment
Share on other sites

  • Moderators

I tried everything and I cannot unregister a hotkey...anyone have any idea's?

Well that statement "tried everything" doesn't really say much considering the code you provided the first time. The call is pretty straight forward, so care to share with us what "everything" is?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

agreed

touche

sorry, and to think I bitch ppl out for this :)

$last = "0x41" ; A

DllCall("user32.dll", "short", "UnRegisterHotKey", "hwnd", $hWnd, "int", "1337" & Dec($last))

DllCall("user32.dll", "short", "UnRegisterHotKey", "hwnd", $hWnd, "int", "1338" & Dec($last))

doing some error testing, I added

msgbox(0,"",$Last) and it returns 0

Dec($last) = 0 when it runs though...but to register a hotkey, it converts it to a decimal... no problem...

edit...it returns correctly if I use $last = "41" ; A but still doesnt unregister the hotkey.

Edited by ReaImDown
[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
Link to comment
Share on other sites

  • Moderators

touche

sorry, and to think I bitch ppl out for this :)

$last = "0x41" ; A

DllCall("user32.dll", "short", "UnRegisterHotKey", "hwnd", $hWnd, "int", "1337" & Dec($last))

DllCall("user32.dll", "short", "UnRegisterHotKey", "hwnd", $hWnd, "int", "1338" & Dec($last))

doing some error testing, I added

msgbox(0,"",$Last) and it returns 0

Dec($last) = 0 when it runs though...but to register a hotkey, it converts it to a decimal... no problem...

edit...it returns correctly if I use $last = "41" ; A but still doesnt unregister the hotkey.

No offense... but this is kind of crap.

Post the whole code including the hwnd you are trying to register the hotkey for and unregister the hotkey for.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

No offense... but this is kind of crap.

Post the whole code including the hwnd you are trying to register the hotkey for and unregister the hotkey for.

basically the same thing as HotKeySet()....only theirs works... -.-'

$hWnd = GUICreate("HotKey Check", 100, 100)
GUIRegisterMsg(0x0312, "Hotkey_a"); Hotkey_a

$LGet = "0x41"
DllCall("user32.dll", "short", "RegisterHotKey", "hwnd", $hWnd, "int", "1337" & Dec($LGet) , "uint", "0x0004", "uint", $LGet)
DllCall("user32.dll", "short", "RegisterHotKey", "hwnd", $hWnd, "int", "1338" & Dec($LGet) , "uint", 0, "uint", $LGet)

while 1
    sleep(100)
WEnd

Func HotKey_a($hWnd, $Msg, $wParam, $letter)
    $last = (StringMid($letter,5,2))
;MsgBox(0,"",$last & "   " & dec($last))
     DllCall("user32.dll", "short", "UnRegisterHotKey", "hwnd", $hWnd, "int", "1337" & Dec($last))
     DllCall("user32.dll", "short", "UnRegisterHotKey", "hwnd", $hWnd, "int", "1338" & Dec($last))
 EndFunc
[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
Link to comment
Share on other sites

basically the same thing as HotKeySet()....only theirs works... -.-'

$hWnd = GUICreate("HotKey Check", 100, 100)
GUIRegisterMsg(0x0312, "Hotkey_a"); Hotkey_a

$LGet = "0x41"
DllCall("user32.dll", "short", "RegisterHotKey", "hwnd", $hWnd, "int", "1337" & Dec($LGet) , "uint", "0x0004", "uint", $LGet)
DllCall("user32.dll", "short", "RegisterHotKey", "hwnd", $hWnd, "int", "1338" & Dec($LGet) , "uint", 0, "uint", $LGet)

while 1
    sleep(100)
WEnd

Func HotKey_a($hWnd, $Msg, $wParam, $letter)
    $last = (StringMid($letter,5,2))
;MsgBox(0,"",$last & "   " & dec($last))
     DllCall("user32.dll", "short", "UnRegisterHotKey", "hwnd", $hWnd, "int", "1337" & Dec($last))
     DllCall("user32.dll", "short", "UnRegisterHotKey", "hwnd", $hWnd, "int", "1338" & Dec($last))
 EndFunc
Try this:

$hWnd = GUICreate("HotKey Check", 100, 100)
GUIRegisterMsg(0x0312, "Hotkey_a"); Hotkey_a

$LGet = "0x41"
DllCall("user32.dll", "short", "RegisterHotKey", "hwnd", $hWnd, "int", "1337" + $LGet , "uint", "0x0004", "uint", $LGet)
DllCall("user32.dll", "short", "RegisterHotKey", "hwnd", $hWnd, "int", "1338" + $LGet , "uint", 0, "uint", $LGet)

while 1
    sleep(100)
WEnd

Func HotKey_a($hWnd, $Msg, $wParam, $letter)
    $last = (StringMid($letter,5,2))
    MsgBox(0,"",$last & "   " & dec($last))
    DllCall("user32.dll", "short", "UnregisterHotKey", "hwnd", $hWnd, "int", "1337" + Dec($last))
    DllCall("user32.dll", "short", "UnregisterHotKey", "hwnd", $hWnd, "int", "1338" + Dec($last))
EndFunc

Comments:

In the original code in the RegisterHotKey call Dec($LGet) has the effect of Dec(0x65) not Dec(0x41).

The & operator concatenates text, the + operator is needed to do math. I am making an assumption that this is what you wanted.

UnRegisterHotKey is not a valid function in user32.dll. The proper name is UnregisterHotKey. DllCall's are case sensitive.

Hope this helps.

Bill

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