DeltaRocked Posted January 21, 2011 Posted January 21, 2011 Hello All, A big thanks to Melba, wraithdu and info (for persistence). I was trying to find a way to keey the virtual keyboard window in non-active state yet accept the clicks and send the same to the active window. PS: got this working without the need for trapping mouse events. just create the window and we are through. GUICreate($MainGUITitle, 722, 194, 300, 300, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST, $_NOACTIVATE)) PPS: using this code its possible to write an Anti-Keylogger based Virtual Keyboard i.e. a Virtual Keyboard whose keystrokes are not recognized by any of the available keylogging methods, whether its a kernel based keylogger or hooks in user-space. regards DeltaRocked
PaprikaBoy90 Posted November 14, 2021 Posted November 14, 2021 On 7/7/2009 at 10:08 PM, wraithdu said: Here ya go: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <ButtonConstants.au3> $WS_EX_NOACTIVATE = 0x08000000 $MA_NOACTIVATE = 3 $MA_NOACTIVATEANDEAT = 4 HotKeySet("{ESC}", "On_Exit") Global $aKeys[48] = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", _ "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "[", "]", _ "A", "S", "D", "F", "G", "H", "J", "K", "L", ";", "'", '"', _ "Z", "X", "C", "V", "B", "N", "M", ",", ".", "/", "spc", "enter"] ; Create "keyboard" GUI $hGUI = GUICreate("Test", 360, 120, 500, 100, $WS_POPUPWINDOW, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST, $WS_EX_NOACTIVATE)) $dummy1 = GUICtrlCreateDummy() $iCount = 0 For $j = 0 To 3 For $i = 0 To 11 GUICtrlCreateButton("", $i * 30, $j * 30, 30, 30) GUICtrlSetData(-1, $aKeys[$iCount]) $iCount += 1 ;~ GUICtrlSetFont(-1, 10) ;~ GUICtrlSetBkColor(-1, 30000 + 2000 * ($i + 1) + 2000 * ($j + 1)) Next Next $dummy2 = GUICtrlCreateDummy() GUISetState() GUIRegisterMsg($WM_MOUSEACTIVATE, 'WM_EVENTS') Run("notepad.exe") While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $dummy1 To $dummy2 Local $sText = ControlGetText($hGUI, "", $msg) ; Write key If $sText = "spc" Then Send("{SPACE}") ElseIf $sText = "enter" Then Send("{ENTER}") Else Send($sText) EndIf EndSwitch WEnd Func WM_EVENTS($hWndGUI, $MsgID, $WParam, $LParam) Switch $hWndGUI Case $hGUI Switch $MsgID Case $WM_MOUSEACTIVATE ; Check mouse position Local $aMouse_Pos = GUIGetCursorInfo($hGUI) If $aMouse_Pos[4] <> 0 Then Local $word = _WinAPI_MakeLong($aMouse_Pos[4], $BN_CLICKED) _SendMessage($hGUI, $WM_COMMAND, $word, GUICtrlGetHandle($aMouse_Pos[4])) EndIf Return $MA_NOACTIVATEANDEAT EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc Func On_Exit() Exit EndFunc hey, thanks for the awesome script, its exactly what i was looking for! I just habe the problem that after the First Button press it Always sends again the First Symbol. so when i press "1" and afterwards "2", the output is "112" why this happens? only change i made is uncomment $WS_EX_NOACTIVATE because i get an Error that im not allowed to change constants
Moderators Melba23 Posted November 14, 2021 Moderators Posted November 14, 2021 Hi, This resurrected thread has been reported as a script for a possible "keylogger" and as such going against the forum rules. However, the scripts within it deal solely with the creation of a virtual keyboard rather than looking at actions using the real key board and so I do not believe that any of them fall into this category. As such I am happy for the thread to remain open. M23 Werty 1 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
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