rayane888 Posted January 24, 2017 Share Posted January 24, 2017 Hello all i need to detect any key pressed by user to continue i have this code but work just for gui "GUIRegisterMsg" is ther any semiler func that detect automatique the key & display msgbox without gui thx masters #include <WindowsConstants.au3> GUIRegisterMsg($WM_KEYDOWN, "IsPressed") $hGui = GUICreate("Press any key within 10s...", 400, 100) GUISetState() Sleep(10000) GUIDelete($hGui) Exit Func IsPressed() MsgBox(4096, "Test", "Key is pressed!", 2) EndFunc Link to comment Share on other sites More sharing options...
ViciousXUSMC Posted January 24, 2017 Share Posted January 24, 2017 Sleep() puts all code to sleep nothing will run or be detected, you need a loop. Just something basic to give you an idea. #include <WindowsConstants.au3> GUIRegisterMsg($WM_KEYDOWN, "IsPressed") $iKeyPress = 0 $hGui = GUICreate("Press any key within 10s...", 400, 100) GUISetState() $iTime =TimerInit() ;Start a Timer While 1 If TimerDiff($iTime) > 10000 Then ExitLoop ;Exit in 10 seconds if no key is pressed If $iKeyPress = 1 Then ExitLoop WEnd Func IsPressed() MsgBox(4096, "Test", "Key is pressed!", 2) $iKeyPress = 1 EndFunc Link to comment Share on other sites More sharing options...
rayane888 Posted January 24, 2017 Author Share Posted January 24, 2017 (edited) 23 minutes ago, ViciousXUSMC said: Sleep() puts all code to sleep nothing will run or be detected, you need a loop. Just something basic to give you an idea. #include <WindowsConstants.au3> GUIRegisterMsg($WM_KEYDOWN, "IsPressed") $iKeyPress = 0 $hGui = GUICreate("Press any key within 10s...", 400, 100) GUISetState() $iTime =TimerInit() ;Start a Timer While 1 If TimerDiff($iTime) > 10000 Then ExitLoop ;Exit in 10 seconds if no key is pressed If $iKeyPress = 1 Then ExitLoop WEnd Func IsPressed() MsgBox(4096, "Test", "Key is pressed!", 2) $iKeyPress = 1 EndFunc but i need without gui ( hiden ) this my broblem becose Guireglmsg it is for gui i need semilar func to detect press key Edited January 24, 2017 by rayane888 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 24, 2017 Moderators Share Posted January 24, 2017 rayane888, Quote i need to detect any key pressed by user This is always a difficult subject - please read this announcement to understand what is and, more importantly, what is NOT, permitted to be discussed here. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
ViciousXUSMC Posted January 24, 2017 Share Posted January 24, 2017 (edited) Yes key loggers and such, we don't wan't people trying to create malware with Autoit. You could try to make your GUI invisible by making it 1px in size or transparent. I do not know your goal, but some creative thinking goes a long way. Edit: oh and hide status for GUI should work as well. Edited January 24, 2017 by ViciousXUSMC Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now