Recently, I learned to use the two API functions that use SetWindowlong and CallWindowProc in designing a hotkey setup program. We can handle any news received by your window or control. I saw a one after another time. Introducing the QQ password to monitor the articles of theft method, so that I think that I can use these two functions to protect the password protection. After some attempt finally succeeded, now I will share it with you. Almost all monitoring programs are sent to get a wm_gettext message by sending a text box for you, any text box will receive this message that it will tell the message to send a message to the content of the yourself (it is not Knowing that it saves our important password), "*" can not protect our password, is it a "smart" text box, in fact, we only need to intercept this message and not let the text box accept When any monitoring program cannot get the password. That is to define the two API functions of SETWINDOWLONG and CALLWINDOWPROC, then determine the message type, if it is the WM_GetText message, it is excluded, and does not process it (of course, you can also replace the subject to accept the message to deceive it) If this text box does not receive this message, it is of course not leaked. The following is a simple introduction: setWindowlong function declaration: declare function setwindowlong lib "user32" Alias "setwindowlonga" (Byval Nindex as long, Byval Dwnewlong As long) AS Long effect: in the window structure Setting information parameters for the specified window: hWnd To set the window handle of the message function (can be a control) NINDEX we use: GWL_WndProc Set the address of the address of the message DWNewlong message function of the GWL_WNDPROC (added to the function name AddressOf, such addressof winproc) return value: If successful return address of the original message processing functions, otherwise 0 Callwindowproc function is declared as follows: Public declare function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc as Long, ByVal hWnd as Long, BYVAL MSG As Long, Byval WParam As long, Byval LParam as long) As long parameter: lpprevwndfunc: points to a pointer to the front window or control process. HWnd: Points the handle of the window or control process of the received message. MSG: Specifies the message type. WPARAM: Specify the rest, message-specific information. The content of this parameter is related to the MSG parameter value. IParam: Specifies the rest, message-specific information. The content of this parameter is related to the MSG parameter value. Return Value: Specifies the message processing result, which is related to the message sent.
Understand these two functions We can make a "smart" text box: 1. First open VB to create a project, add a form, a module 2. Add the declaration of the above two functions to the module, Plus the declaration of two variables is the public const wm_gettext = & hd 'Get text box content message public const gwl_wndproc (-4)' Establishing a message processing function required for parameter publiC as long 'Save the old message processing function 3. Create a text box on the form, a command button, two checkbox modify its properties as follows: Control Name: Property: Property: Text box passwordchar * Name Text1 Command button Name Command1 CAPTION Real Password Check box 1 name Check1 CAPTION uses password protection check box 1 name Check2 CAPTION uses password deception 4. Writing code (Program is simple) Add: private sub check1_click () if check1.value = 1 Then OldProc = setWindowlong (Text1.hwnd, GWL_WndProc Addressof WND 'Settings the message processing function of Text1, OldProc is the address of the original function Else Setwindowlong text1.hWnd, GWL_WndProc, OldProc' Restore the original message function address check2.value = 0 'If you do not use password protection, you cannot use password spoof End IfEnd SubPrivate Sub Check2_Click () If Check2.Value = 1 Then if check1.value = 0 then 'spoofing If a password must be password-protected Oldproc = SetWindowLong (Text1.hwnd, GWL_WNDPROC, AddressOf wnd) Check1.Value = 1 end ifEnd IfEnd Sub