Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Key logger applications use mechanisms such as <a href="http://msdn.microsoft.com/en-us/library/ms997537.aspx." rel="noreferrer">Win32 Hooks</a>. Specifically you need to set a <code>WH_KEYBOARD</code> hook.</p> <p>There are move advanced techniques, like creating your own keyboard driver but for a start hooks are a good choice.</p> <p><strong>Edit:</strong> To get an idea of how a hook procedure looks like, I post a fragment from my personal utility.</p> <pre><code>// ... thehook = SetWindowsHookEx( WH_KEYBOARD_LL, hook_proc, hwnd, 0 ); // ... /** * * wParam, one of the: WM_KEYDOWN, WM_KEYUP, WM_SYSKEYDOWN, or WM_SYSKEYUP lParam: pointer to a KBDLLHOOKSTRUCT structure (*) "The hook procedure should process a message in less time than the data entry specified in the LowLevelHooksTimeout value in the following registry key: HKEY_CURRENT_USER\Control Panel\Desktop The value is in milliseconds. If the hook procedure does not return during this interval, the system will pass the message to the next hook." * */ LRESULT CALLBACK hook_proc( int code, WPARAM wParam, LPARAM lParam ) { static long ctrl_cnt = 0; static bool mmode = false; static DWORD time; KBDLLHOOKSTRUCT* kbd = (KBDLLHOOKSTRUCT*)lParam; if ( code &lt; 0 || (kbd-&gt;flags &amp; 0x10) // ignore injected events ) return CallNextHookEx( thehook, code, wParam, lParam ); long ret = 1; // by default I swallow the keys if ( mmode ) { // macro mode is ON if ( WM_KEYDOWN == wParam ) PostMessage(mainwnd, WM_MCR_ACCUM, kbd-&gt;vkCode, 0); if ( WM_KEYUP == wParam ) switch (kbd-&gt;vkCode) { case VK_ESCAPE: mmode = false; keys.removeall(); PostMessage(mainwnd, WM_MCR_HIDE, 0, 0); break; case VK_RETURN: PostMessage(mainwnd, WM_MCR_EXEC, 0, 0); break; case VK_LCONTROL: mmode = false; PostMessage(mainwnd, WM_MCR_HIDE, 0, 0); PostMessage(mainwnd, WM_MCR_EXEC, 0, 0); break; } /* Which non printable keys allow passing? */ switch( kbd-&gt;vkCode ) { case VK_LCONTROL: case VK_CAPITAL: case VK_LSHIFT: case VK_RSHIFT: ret = CallNextHookEx( thehook, code, wParam, lParam ); } } else { // macro mode is OFF /* Ctrl pressed */ if ( kbd-&gt;vkCode == VK_LCONTROL &amp;&amp; WM_KEYDOWN == wParam ) { ctrl_cnt = 1; time = kbd-&gt;time; } /* Prevent ctrl combinations to activate macro mode */ if ( kbd-&gt;vkCode != VK_LCONTROL ) ctrl_cnt = 0; /* Ctrl released */ if ( ctrl_cnt == 1 &amp;&amp; WM_KEYUP == wParam ) { if ( kbd-&gt;time - time &gt; 40 ) { mmode = true; PostMessage(mainwnd, WM_MCR_SHOW, 0, 0); } } ret = CallNextHookEx( thehook, code, wParam, lParam ); // let it pass } return ret; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload