Jump to content

_IsPressed


Recommended Posts

#Include <Misc.au3>

While 1
   If _Ispressed ("C0") Then
      MsgBox (0,0,0)
      Exit
   EndIf
WEnd'

MDiesel

Thanks for your reply.

I got another query. What is the Code for the the Enter Key in the NumPad?

Link to comment
Share on other sites

Thanks for your reply. How to differentiate the Main Enter key press and the NumPad Enter key press?

This is one way to differentiate which enter key is pressed.

This works on my XP.

Don't know if it will work with different keyboard layouts and operating systems.

;
Global Const $WM_KEYUP = 0x0101

$Gui = GUICreate("Test which enter key is pressed example. (Esc to exit)", 400, 50)
GUISetState(@SW_SHOW, $Gui)

GUIRegisterMsg($WM_KEYUP, "WindowEvents")

While Sleep(150)
WEnd

Func WindowEvents($hWnd, $Msg, $wParam, $lParam)
;ConsoleWrite(" $hWnd " & $hWnd & " $Msg " & $Msg & " $wParam " & $wParam & " $lParam " & $lParam & @CRLF)
    Switch $wParam; Virtual key code - a list can be found under _IsPressed(), Help file.
        Case 0x1b; Esc to exit
            Exit
        Case 0x0D; Enter key
            If BitShift(BitAND($lParam, 0x0F000000), 24) Then; Determined by use of the utility obtained from
            ;   http://www.autoitscript.com/forum/index.php?s=&showtopic=62304&view=findpost&p=466668
                MsgBox(0, "", "Num Pad ENTER Pressed")
            Else
                MsgBox(0, "", "Main ENTER Pressed, (not the Num Pad one)")
            EndIf
    EndSwitch
EndFunc  ;==>WindowEvents
;
Link to comment
Share on other sites

This is one way to differentiate which enter key is pressed.

This works on my XP.

Don't know if it will work with different keyboard layouts and operating systems.

;
Global Const $WM_KEYUP = 0x0101

$Gui = GUICreate("Test which enter key is pressed example. (Esc to exit)", 400, 50)
GUISetState(@SW_SHOW, $Gui)

GUIRegisterMsg($WM_KEYUP, "WindowEvents")

While Sleep(150)
WEnd

Func WindowEvents($hWnd, $Msg, $wParam, $lParam)
;ConsoleWrite(" $hWnd " & $hWnd & " $Msg " & $Msg & " $wParam " & $wParam & " $lParam " & $lParam & @CRLF)
    Switch $wParam; Virtual key code - a list can be found under _IsPressed(), Help file.
        Case 0x1b; Esc to exit
            Exit
        Case 0x0D; Enter key
            If BitShift(BitAND($lParam, 0x0F000000), 24) Then; Determined by use of the utility obtained from
        ;   http://www.autoitscript.com/forum/index.php?s=&showtopic=62304&view=findpost&p=466668
                MsgBox(0, "", "Num Pad ENTER Pressed")
            Else
                MsgBox(0, "", "Main ENTER Pressed, (not the Num Pad one)")
            EndIf
    EndSwitch
EndFunc ;==>WindowEvents
;
Thanks for your reply Malkey. Is there a specific code for the Main Enter key and the Numpad Enter Key?
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...