dbzfanatic 0 Posted September 25, 2007 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 Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Share this post Link to post Share on other sites
SmOke_N 211 Posted September 25, 2007 $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") EndIfShould 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