<?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[message intercepting]]></title><description><![CDATA[<p>hi,<br />
ich muss von einem anderen Programm (in einer dll die ich injecte) die nachrichtenschleife irgendwie abfangen oder ersetzten, da ich auch über die Nachrichten informiert werden will. Hat jemand gute Codes oder nen Link?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/245604/message-intercepting</link><generator>RSS for Node</generator><lastBuildDate>Fri, 03 Apr 2026 18:42:49 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/245604.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 16 Jul 2009 09:39:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to message intercepting on Thu, 16 Jul 2009 09:39:57 GMT]]></title><description><![CDATA[<p>hi,<br />
ich muss von einem anderen Programm (in einer dll die ich injecte) die nachrichtenschleife irgendwie abfangen oder ersetzten, da ich auch über die Nachrichten informiert werden will. Hat jemand gute Codes oder nen Link?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1743993</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1743993</guid><dc:creator><![CDATA[DouglesInHouse]]></dc:creator><pubDate>Thu, 16 Jul 2009 09:39:57 GMT</pubDate></item><item><title><![CDATA[Reply to message intercepting on Thu, 16 Jul 2009 11:23:29 GMT]]></title><description><![CDATA[<p>was wilst du genau machen. welche msg, wieso hookst du nich einfach die entsprechende wndproc oder reicht dies nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1744068</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1744068</guid><dc:creator><![CDATA[hm naja]]></dc:creator><pubDate>Thu, 16 Jul 2009 11:23:29 GMT</pubDate></item><item><title><![CDATA[Reply to message intercepting on Thu, 16 Jul 2009 11:40:15 GMT]]></title><description><![CDATA[<p>das versuche ich doch...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1744093</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1744093</guid><dc:creator><![CDATA[DouglesInHouse]]></dc:creator><pubDate>Thu, 16 Jul 2009 11:40:15 GMT</pubDate></item><item><title><![CDATA[Reply to message intercepting on Thu, 16 Jul 2009 16:10:11 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">void SetHook(HWND hWnd)
{
        myhWnd = hWnd;

        if(!ghHook)
        {
                ghHook = ggSetWindowsHookExA(WH_CALLWNDPROC, (HOOKPROC)BrowserHookProc, hInstDll, 0);
                if(!ghHook)
                {
                        MessageBox(NULL,&quot;Hook kann nicht erstellt werden&quot;, &quot;FEHLER&quot;, MB_OK | MB_ICONERROR);
                }
        }
        else
        {
                MessageBox(NULL, &quot;Hook ist bereits erstellt&quot;, &quot;Browser Window Hook&quot;, MB_OK);
        }
}
//---------------------------------------------------------------------------
void RemoveHook(void)
{
        ggUnhookWindowsHookEx(ghHook);
}
//---------------------------------------------------------------------------
LRESULT CALLBACK BrowserHookProc(int nCode, WPARAM wParam, LPARAM lParam)
{
    switch (nCode) 
    {
    case WM_KEYDOWN:
        {
            MessageBox(0,&quot;Key Pressed&quot;,&quot;you have pressed a key&quot;,MB_OK);
        }
    }

     return CallNextHookEx(ghHook, nCode, wParam, lParam);
}
</code></pre>
<p>hab diesen Code hier im Forum gefunden, BrowserHookProc wird zwar aufgerufen aber WM_KEYDOWN nicht, obwohl ich bei dem Programm in das ich injecte auf der Tastatur was eingebe...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1744406</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1744406</guid><dc:creator><![CDATA[DouglesInHouse]]></dc:creator><pubDate>Thu, 16 Jul 2009 16:10:11 GMT</pubDate></item><item><title><![CDATA[Reply to message intercepting on Thu, 16 Jul 2009 17:54:45 GMT]]></title><description><![CDATA[<p>hab noch nen weiteren Code geschrieben, aber auch er erkennt die Tastatur nicht?</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;

LRESULT HookMain(int code,WPARAM wParam, LPARAM lParam);
int SetHook(HWND hWnd);
HHOOK g_hHook;
HWND hWnd;
UINT    WM_HOOKEX = 0;
WNDPROC                OldFlyffProc = NULL;    
HINSTANCE hDll;

LRESULT CALLBACK    NewProc( HWND,UINT,WPARAM,LPARAM );

BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
                     )
{
    switch (ul_reason_for_call)
    {
    case DLL_PROCESS_ATTACH:
    if (!hWnd) 
    {
	HINSTANCE hInst = LoadLibrary(&quot;user32.dll&quot;);
       hWnd= FindWindow(NULL, &quot;windowfromprogram&quot;);
    SetHook(hWnd);

    }
    if(!WM_HOOKEX)
    {
        WM_HOOKEX = RegisterWindowMessage(&quot;WM_HOOKEX_RK&quot;);    
    }
    hDll = (HINSTANCE) hModule;
    case DLL_THREAD_ATTACH:
    case DLL_THREAD_DETACH:
    case DLL_PROCESS_DETACH:
        break;
    }
    return TRUE;
}

int SetHook(HWND hWnd)
{
    g_hHook = SetWindowsHookExA(WH_CALLWNDPROC,(HOOKPROC)HookMain, hDll, GetWindowThreadProcessId(hWnd,NULL));
    if( g_hHook==NULL )
    return 0;
    else
    {
        SendMessage(hWnd, WM_HOOKEX,0,1); // hier bleibt das Programm hängen
    return 1;
    }
}

#define pCW ((CWPSTRUCT*)lParam)
LRESULT HookMain(int code,WPARAM wParam, LPARAM lParam)
{
    if((pCW-&gt;message == WM_HOOKEX) &amp;&amp; pCW-&gt;lParam) 
    {
        MessageBox(hWnd,&quot;Hooked&quot;,&quot;I'm Hooked!&quot;,MB_OK);
        UnhookWindowsHookEx(g_hHook);

        char lib_name[MAX_PATH]; 
        GetModuleFileName(hDll,lib_name,MAX_PATH);

        if(!LoadLibrary(lib_name))
        {
           return CallNextHookEx(g_hHook, code, wParam, lParam);    
        }

        OldProc = (WNDPROC)SetWindowLong(hWnd, GWL_WNDPROC, (long)NewProc);
        if(!OldProc)
        {
            FreeLibrary(hDll);
        }
    }
    return CallNextHookEx(g_hHook, code, wParam, lParam);
}

LRESULT CALLBACK NewProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
    switch (uMsg) 
    {
    case WM_KEYDOWN:
        {
            MessageBox(hwnd,&quot;Key Pressed&quot;,&quot;NewProc&quot;,MB_OK);
             // warum komme ich hier nicht her wenn ich nen Key drücke?
        }
    }
    return CallWindowProc( OldFlyffProc,hwnd,uMsg,wParam,lParam ); 
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1744450</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1744450</guid><dc:creator><![CDATA[DouglesInHouse]]></dc:creator><pubDate>Thu, 16 Jul 2009 17:54:45 GMT</pubDate></item><item><title><![CDATA[Reply to message intercepting on Fri, 17 Jul 2009 09:11:52 GMT]]></title><description><![CDATA[<p>lies die MSDN, der 1.code ist doch totaler schwachsinn. nCode beinhaltet doch nicht die window message. der 2.ruft allerlei krempel und library funktionen in DLL_PROCESS_ATTACH auf. nicht der grund, warum es nicht geht, aber das ist nicht erlaubt und kann ernsthafte probleme verursachen. solche frickeleien führen dann eben zu sowas. lies die MSDN zu hooks und zwar von anfang bis ende und nicht die ersten 2 zeilen, dann klappts auch mit dem hooken.</p>
<p>außerdem würd ich einfach in der Dll die Wndproc des fenster mit SetWindowLong h00ken, is doch viel einfacher und ned so'ne h00k frickelei</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1744678</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1744678</guid><dc:creator><![CDATA[L0rd Crush3r]]></dc:creator><pubDate>Fri, 17 Jul 2009 09:11:52 GMT</pubDate></item><item><title><![CDATA[Reply to message intercepting on Fri, 17 Jul 2009 15:17:44 GMT]]></title><description><![CDATA[<p>also brauch ich den hook mist gar nicht? Aber wie soll das nur mit SetWindowLong gehen? Wäre sehr dankbar für mehr Hilfe <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1744913</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1744913</guid><dc:creator><![CDATA[DouglesInHouse]]></dc:creator><pubDate>Fri, 17 Jul 2009 15:17:44 GMT</pubDate></item><item><title><![CDATA[Reply to message intercepting on Fri, 17 Jul 2009 15:54:49 GMT]]></title><description><![CDATA[<p>danke L0rd!! Warum sagen alle ich muss so nen gefrickel machen wenn ein simpler call zu SetWindowLong ausreicht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /> -.-</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1744923</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1744923</guid><dc:creator><![CDATA[DouglesInHouse]]></dc:creator><pubDate>Fri, 17 Jul 2009 15:54:49 GMT</pubDate></item><item><title><![CDATA[Reply to message intercepting on Fri, 17 Jul 2009 17:17:36 GMT]]></title><description><![CDATA[<p>also ich Zeige euch mal meinen Code:</p>
<pre><code class="language-cpp">OldProc = (WNDPROC)SetWindowLong(FindWindow(0, TEXT(&quot;name&quot;)), GWL_WNDPROC, (LONG)NewProc);
////
LRESULT CALLBACK NewProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
    switch (uMsg) 
    {
    case WM_KEYDOWN:

		  switch(wParam)
		  {
		  case VK_F1:
                          Beep(2000, 2000);
			  break;
		  }
		  return 0;
    }
    return CallWindowProc(OldProc,hwnd,uMsg,wParam,lParam ); 
}
</code></pre>
<p>alles Funktioniert gut, ABER es hat den seltsamen Nebeneffekt, dass Entf und löschen nicht mehr funktioniert? Das heißt das Programme zeigt keine Reaktion wenn ich diese drücken, ohne der dll tut es das aber.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1744959</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1744959</guid><dc:creator><![CDATA[DouglesInHouse]]></dc:creator><pubDate>Fri, 17 Jul 2009 17:17:36 GMT</pubDate></item><item><title><![CDATA[Reply to message intercepting on Fri, 17 Jul 2009 19:41:50 GMT]]></title><description><![CDATA[<p>das return 0; verhindert ja auch dass CallWindowProc aufgerufen wird. mach das mal zu break;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1745036</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1745036</guid><dc:creator><![CDATA[L0rd Crush3r]]></dc:creator><pubDate>Fri, 17 Jul 2009 19:41:50 GMT</pubDate></item><item><title><![CDATA[Reply to message intercepting on Fri, 17 Jul 2009 20:43:45 GMT]]></title><description><![CDATA[<p>L0rd Crush3r so klappt es!! Vielen Dank für deine HIlfe <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1745062</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1745062</guid><dc:creator><![CDATA[DouglesInHouse]]></dc:creator><pubDate>Fri, 17 Jul 2009 20:43:45 GMT</pubDate></item></channel></rss>