<?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[Problem mit Umleiten von einer FrameWndProc nach anderer FrameWndProc]]></title><description><![CDATA[<p>Hallo! Ich will die WndProc so umleiten, dass ich Zugang zu Objektdaten habe, also this soll übergeben werden.</p>
<pre><code class="language-cpp">class frame {
protected:
		HINSTANCE hInstance;
		HWND hFrame, hClient;
public:
	frame(HINSTANCE h)
	:hInstance(h), hFrame(0), hClient(0) {
        WNDCLASS wndclass;
	wndclass.style         = CS_HREDRAW | CS_VREDRAW;
	wndclass.lpfnWndProc   = FakeFrameWndProc;
	wndclass.cbClsExtra    = 0;
	wndclass.cbWndExtra    = 0;
	wndclass.hInstance     = hInstance;
	wndclass.hIcon         = LoadIcon(0, /*...*/);
	wndclass.hCursor       = LoadCursor(0, IDC_ARROW);
	wndclass.hbrBackground = (HBRUSH) (COLOR_APPWORKSPACE + 1);
	wndclass.lpszMenuName  = /*...*/;
	wndclass.lpszClassName = /*...*/;

        hFrame = CreateWindow(/*...*/, /*...*/,
				WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
				CW_USEDEFAULT, CW_USEDEFAULT,
				CW_USEDEFAULT, CW_USEDEFAULT,
				0, 0, hInstance, this);
}

        virtual LRESULT CALLBACK FrameWndProc(HWND, UINT, WPARAM, LPARAM) = 0;

	static LRESULT CALLBACK FakeFrameWndProc(HWND h, UINT m, WPARAM w, LPARAM l) {
			static frame* pf;
			if(WM_CREATE == m)
				pf = (frame*)(l);
			return pf-&gt;FrameWndProc(h, m, w, l);
		}
</code></pre>
<p>Jetzt überlade ich die reelle FrameWndProc, so dass return pf-&gt;FrameWndProc(h, m, w, l); Sinn macht:</p>
<pre><code class="language-cpp">class application: public frame {
public:
	application(HINSTANCE h)
			:frame(h) {}

	LRESULT CALLBACK FrameWndProc(HWND, UINT, WPARAM, LPARAM)
{/* hier ist die Implementation der FrameWndProc MIT ZUGANG ZU DATEN VON application, bzw. frame */}
};
</code></pre>
<p>Problem: Die fake Prozedur arbeitet nicht korrekt:</p>
<pre><code class="language-cpp">static LRESULT CALLBACK FakeFrameWndProc(HWND h, UINT m, WPARAM w, LPARAM l) {
			static frame* pf;
			if(WM_CREATE == m)
				pf = (frame*)(l);
			return pf-&gt;FrameWndProc(h, m, w, l); // pf bleibt 0
		}
</code></pre>
<p>In MSDN steht folgendes:</p>
<blockquote>
<p>lpParam<br />
[in] Pointer to a value to be passed to the window through the CREATESTRUCT structure (lpCreateParams member) pointed to by the lParam param of the WM_CREATE message. This message is sent to the created window by this function before it returns.</p>
</blockquote>
<p>Also, sollte WM_CREATE die erste Meldung sein. Trotzdem bleibt pf gleich 0. Warum? <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/topic/187221/problem-mit-umleiten-von-einer-framewndproc-nach-anderer-framewndproc</link><generator>RSS for Node</generator><lastBuildDate>Sat, 04 Jul 2026 13:35:48 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/187221.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 17 Jul 2007 10:28:41 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem mit Umleiten von einer FrameWndProc nach anderer FrameWndProc on Tue, 17 Jul 2007 10:28:41 GMT]]></title><description><![CDATA[<p>Hallo! Ich will die WndProc so umleiten, dass ich Zugang zu Objektdaten habe, also this soll übergeben werden.</p>
<pre><code class="language-cpp">class frame {
protected:
		HINSTANCE hInstance;
		HWND hFrame, hClient;
public:
	frame(HINSTANCE h)
	:hInstance(h), hFrame(0), hClient(0) {
        WNDCLASS wndclass;
	wndclass.style         = CS_HREDRAW | CS_VREDRAW;
	wndclass.lpfnWndProc   = FakeFrameWndProc;
	wndclass.cbClsExtra    = 0;
	wndclass.cbWndExtra    = 0;
	wndclass.hInstance     = hInstance;
	wndclass.hIcon         = LoadIcon(0, /*...*/);
	wndclass.hCursor       = LoadCursor(0, IDC_ARROW);
	wndclass.hbrBackground = (HBRUSH) (COLOR_APPWORKSPACE + 1);
	wndclass.lpszMenuName  = /*...*/;
	wndclass.lpszClassName = /*...*/;

        hFrame = CreateWindow(/*...*/, /*...*/,
				WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
				CW_USEDEFAULT, CW_USEDEFAULT,
				CW_USEDEFAULT, CW_USEDEFAULT,
				0, 0, hInstance, this);
}

        virtual LRESULT CALLBACK FrameWndProc(HWND, UINT, WPARAM, LPARAM) = 0;

	static LRESULT CALLBACK FakeFrameWndProc(HWND h, UINT m, WPARAM w, LPARAM l) {
			static frame* pf;
			if(WM_CREATE == m)
				pf = (frame*)(l);
			return pf-&gt;FrameWndProc(h, m, w, l);
		}
</code></pre>
<p>Jetzt überlade ich die reelle FrameWndProc, so dass return pf-&gt;FrameWndProc(h, m, w, l); Sinn macht:</p>
<pre><code class="language-cpp">class application: public frame {
public:
	application(HINSTANCE h)
			:frame(h) {}

	LRESULT CALLBACK FrameWndProc(HWND, UINT, WPARAM, LPARAM)
{/* hier ist die Implementation der FrameWndProc MIT ZUGANG ZU DATEN VON application, bzw. frame */}
};
</code></pre>
<p>Problem: Die fake Prozedur arbeitet nicht korrekt:</p>
<pre><code class="language-cpp">static LRESULT CALLBACK FakeFrameWndProc(HWND h, UINT m, WPARAM w, LPARAM l) {
			static frame* pf;
			if(WM_CREATE == m)
				pf = (frame*)(l);
			return pf-&gt;FrameWndProc(h, m, w, l); // pf bleibt 0
		}
</code></pre>
<p>In MSDN steht folgendes:</p>
<blockquote>
<p>lpParam<br />
[in] Pointer to a value to be passed to the window through the CREATESTRUCT structure (lpCreateParams member) pointed to by the lParam param of the WM_CREATE message. This message is sent to the created window by this function before it returns.</p>
</blockquote>
<p>Also, sollte WM_CREATE die erste Meldung sein. Trotzdem bleibt pf gleich 0. Warum? <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/1327104</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1327104</guid><dc:creator><![CDATA[khalderon]]></dc:creator><pubDate>Tue, 17 Jul 2007 10:28:41 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Umleiten von einer FrameWndProc nach anderer FrameWndProc on Tue, 17 Jul 2007 16:02:41 GMT]]></title><description><![CDATA[<p>Ist meine Frage so schwierig, dass niemand hier sie beantworten kann? Ich dachte sie sind Profis <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_down"
      title=":-1:"
      alt="👎"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1327343</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1327343</guid><dc:creator><![CDATA[khalderon]]></dc:creator><pubDate>Tue, 17 Jul 2007 16:02:41 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Umleiten von einer FrameWndProc nach anderer FrameWndProc on Wed, 18 Jul 2007 06:13:55 GMT]]></title><description><![CDATA[<p>WM_CREATE ist nicht die erste Nachricht die ein Fenster bekommt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1327515</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1327515</guid><dc:creator><![CDATA[-.-]]></dc:creator><pubDate>Wed, 18 Jul 2007 06:13:55 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Umleiten von einer FrameWndProc nach anderer FrameWndProc on Wed, 18 Jul 2007 06:24:21 GMT]]></title><description><![CDATA[<p>Schau Dir doch einfach mal an wie das andere Frameworks wie wxwidgedts, WTL oder MFC machen... dann wirst Du die ganze Problematik verstehen...<br />
Die MFC setzt um CreateWindow z.B. einen Hook um auch wirklich &quot;alle&quot; Messages zu bekommen...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1327521</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1327521</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Wed, 18 Jul 2007 06:24:21 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Umleiten von einer FrameWndProc nach anderer FrameWndProc on Wed, 18 Jul 2007 07:25:44 GMT]]></title><description><![CDATA[<p>-.- schrieb:</p>
<blockquote>
<p>WM_CREATE ist nicht die erste Nachricht die ein Fenster bekommt.</p>
</blockquote>
<p>Dann welche?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1327534</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1327534</guid><dc:creator><![CDATA[khalderon]]></dc:creator><pubDate>Wed, 18 Jul 2007 07:25:44 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Umleiten von einer FrameWndProc nach anderer FrameWndProc on Wed, 18 Jul 2007 08:29:02 GMT]]></title><description><![CDATA[<p>WM_NCCREATE, WM_NCCALCSIZE</p>
<p>Und siehe auch Doku zu &quot;CBTProc&quot;:</p>
<blockquote>
<p>It is possible to send messages to the newly created window, although it has not yet received WM_NCCREATE or WM_CREATE messages.</p>
</blockquote>
<p>Es kann sozusagen jede beliebige Nachricht ankommen, wenn sie Dir geschickt wird...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1327579</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1327579</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Wed, 18 Jul 2007 08:29:02 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Umleiten von einer FrameWndProc nach anderer FrameWndProc on Wed, 18 Jul 2007 08:44:50 GMT]]></title><description><![CDATA[<p>Hmmmm... komisch!<br />
Dann soll ich lieber globale Variablen benutzen, oder?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1327591</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1327591</guid><dc:creator><![CDATA[khalderon]]></dc:creator><pubDate>Wed, 18 Jul 2007 08:44:50 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Umleiten von einer FrameWndProc nach anderer FrameWndProc on Wed, 18 Jul 2007 08:46:22 GMT]]></title><description><![CDATA[<p>Die MFC nutzt um das &quot;CreateWindow&quot; herum ein CBTProc-Hook (Thread-Spezifisch, also TLS).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1327592</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1327592</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Wed, 18 Jul 2007 08:46:22 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Umleiten von einer FrameWndProc nach anderer FrameWndProc on Wed, 18 Jul 2007 08:46:55 GMT]]></title><description><![CDATA[<p>Jochen Kalmbach schrieb:</p>
<blockquote>
<p>Die MFC nutzt um das &quot;CreateWindow&quot; herum ein CBTProc-Hook (Thread-Spezifisch, also TLS).</p>
</blockquote>
<p>und setzt darin dann die passende WndProc...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1327594</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1327594</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Wed, 18 Jul 2007 08:46:55 GMT</pubDate></item></channel></rss>