Sign in to follow this  
Followers 0
dbzfanatic

_IsPressed Vista Help

2 posts in this topic

I'm running windows Vista and I want something to happen when a key is pressed (duh). The problem is that when the program starts, before I touch any keys, the action is taken and repeats. Here's my code (some of it) for refference.

#include <GUIConstants.au3>
#include <misc.au3>
#RequireAdmin
$progWidth = @DesktopWidth * 2
$progHeight = @DesktopHeight * 2

#Region ### START Koda GUI section ### Form=
$frmDesktopLocker = GUICreate("Desktop Locker",$progWidth + 5, $progHeight + 25, -5, -25 ,0 ,0)
GUISetBkColor(0x000000)
$passinput = GUICtrlCreateInput("", 136, 128, 153, 21,0,0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Global $oStoredPass
BlockInput(1)
GUISetState(@SW_SHOW)

While 1 
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_Event_Close
        Case $passinput
            $oPassword = GUICtrlRead($passinput)
            If $oPassword = $oStoredPass Then
                Exit
            EndIf
        ......
        Case _IsPressed(41)
        GUICtrlSetData($passinput, GUICtrlRead($passinput) & "a")
        MsgBox("", "", "works")
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites



$nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_Event_Close
        Case $passinput
            $oPassword = GUICtrlRead($passinput)
            If $oPassword = $oStoredPass Then
                Exit
            EndIf
        ......
        Case _IsPressed(41)
        GUICtrlSetData($passinput, GUICtrlRead($passinput) & "a")
        MsgBox("", "", "works")
    EndSwitchoÝ÷ ÛMúË ­ën®{4ù趧+¢w°ØbØ^B°úÞ²ÇEën®}"b²}ý¶Þ²Ç²aj×±ë-jצz{b²Úîxp¢é]~*ÞB¶¹RzÐÚµªÞªÝë,¡ü!jÚ)z¶­x,ÊË^*.Áê޺ȧ'ç¢Øb±·¢ÛhBzÓ,MúË jëh×6    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_Event_Close
            Exit
        Case $passinput
            $oPassword = GUICtrlRead($passinput)
            If $oPassword = $oStoredPass Then
                Exit
            EndIf
    EndSwitch
    If _IsPressed(41) Then
        GUICtrlSetData($passinput, GUICtrlRead($passinput) & "a")
        MsgBox("", "", "works")
    EndIf
Should work.


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.

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