Jump to content

Recommended Posts

Posted

how can I detect keypress on textbox so that I can display ALT+ , SHFT+ , CTRL+ on textbox.

while 1
If _IsPressed('12') Then
    msgbox(0,"","")
EndIf
WEnd

Func _IsPressed($hexKey)


 
 Local $aR, $bRv
 $hexKey = '0x' & $hexKey
 $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey)

 If $aR[0] <> 0 Then
    $bRv = 1
 Else
    $bRv = 0
 EndIf
 
 Return $bRv
EndFunc

I got a simple keypress program

Posted

Maybe this code should help you.. ;)

#include <Misc.au3>

Local $x = 0, $y = 0
GUICreate("", 140, 40)
$hEdit = GUICtrlCreateInput("", 10, 10, 120, 25)
GUISetState()

While 1
    $msg = GUIGetMsg()

    If _IsPressed(10) And $x = 0 Then
        GUICtrlSetData($hEdit, GUICtrlRead($hEdit) & "SHIFT + ")
        $x = 1
    ElseIf _IsPressed(11) And $x = 0 Then
        GUICtrlSetData($hEdit, GUICtrlRead($hEdit) & "CTRL + ")
        $x = 1
    ElseIf _IsPressed(12) And $x = 0 Then
        GUICtrlSetData($hEdit, GUICtrlRead($hEdit) & "ALT + ")
        $x = 1
    EndIf

    If $x = 1 Then
        $y += 1
        If $y = 100 Then
            $x = 0
            $y = 0
        EndIf
    EndIf

    If $msg = -3 Then ExitLoop
WEnd

[size="2"][font="Lucida Sans Unicode"][b][/b][/font][/size]

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
  • Recently Browsing   0 members

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