<?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[DLGPROC als CALLBACK in einer Klasse]]></title><description><![CDATA[<p>Hi, ich kriege es nicht hin die DlgProc für ein Fenster in eine Klasse zu packen. Wenn ich das ausserhalb der Klasse benutze funktioniert es wunderbar:</p>
<p>Hier der Codeteil:</p>
<pre><code>class MD
{
public:
	...
	BOOL DisplayOwnWindow(VOID);
	BOOL CALLBACK DlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
	...
private:

	HINSTANCE wndInstance;
}; extern MD *md = new MD;

BOOL CALLBACK MD::DlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{

    switch (message)
	{
		case WM_INITDIALOG:
			return TRUE;

		case WM_COMMAND:
			return TRUE;

		case WM_DESTROY:
			PostQuitMessage(0);
			return TRUE;

		case WM_CLOSE:
			PostQuitMessage(0);
			return TRUE;

		case WM_TIMER:
			return TRUE;
    }
    return FALSE;
}

BOOL MD::DisplayOwnWindow(VOID)
{
	DialogBox(GetCurrentWindowInst(), MAKEINTRESOURCE(IDD_MAINDLG), 0, DlgProc);
}
</code></pre>
<p>Im oberen Code kriege ich die Meldung:</p>
<blockquote>
<p>c:\Proj\GHT\mdump\mdump.cpp(35) : error C4867: 'MDump::MDumpDlg': function call missing argument list; use '&amp;MDump::MDumpDlg' to create a pointer to member<br />
c:\Proj\GHT\mdump\mdump.cpp(35) : error C2664: 'DialogBoxParamA' : cannot convert parameter 4 from 'BOOL (__stdcall *)(HWND,UINT,WPARAM,LPARAM)' to 'DLGPROC'</p>
</blockquote>
<p>wenn ich DlgProc auf &quot;DLGPROC&quot; beim Aufruf von DialogBox caste bekomme ich:</p>
<blockquote>
<p>c:\Proj\GHT\mdump\mdump.cpp(35) : error C2440: 'type cast' : cannot convert from 'overloaded-function' to 'DLGPROC'</p>
</blockquote>
<p>wie gesagt, wenn ich die DlgProc ausserhalb der Klasse ablege funktioniert es.<br />
Ich hoffe mir kann hierbei jemand helfen.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/101761/dlgproc-als-callback-in-einer-klasse</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Apr 2026 02:41:56 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/101761.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 19 Feb 2005 12:26:20 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to DLGPROC als CALLBACK in einer Klasse on Sat, 19 Feb 2005 12:26:20 GMT]]></title><description><![CDATA[<p>Hi, ich kriege es nicht hin die DlgProc für ein Fenster in eine Klasse zu packen. Wenn ich das ausserhalb der Klasse benutze funktioniert es wunderbar:</p>
<p>Hier der Codeteil:</p>
<pre><code>class MD
{
public:
	...
	BOOL DisplayOwnWindow(VOID);
	BOOL CALLBACK DlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
	...
private:

	HINSTANCE wndInstance;
}; extern MD *md = new MD;

BOOL CALLBACK MD::DlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{

    switch (message)
	{
		case WM_INITDIALOG:
			return TRUE;

		case WM_COMMAND:
			return TRUE;

		case WM_DESTROY:
			PostQuitMessage(0);
			return TRUE;

		case WM_CLOSE:
			PostQuitMessage(0);
			return TRUE;

		case WM_TIMER:
			return TRUE;
    }
    return FALSE;
}

BOOL MD::DisplayOwnWindow(VOID)
{
	DialogBox(GetCurrentWindowInst(), MAKEINTRESOURCE(IDD_MAINDLG), 0, DlgProc);
}
</code></pre>
<p>Im oberen Code kriege ich die Meldung:</p>
<blockquote>
<p>c:\Proj\GHT\mdump\mdump.cpp(35) : error C4867: 'MDump::MDumpDlg': function call missing argument list; use '&amp;MDump::MDumpDlg' to create a pointer to member<br />
c:\Proj\GHT\mdump\mdump.cpp(35) : error C2664: 'DialogBoxParamA' : cannot convert parameter 4 from 'BOOL (__stdcall *)(HWND,UINT,WPARAM,LPARAM)' to 'DLGPROC'</p>
</blockquote>
<p>wenn ich DlgProc auf &quot;DLGPROC&quot; beim Aufruf von DialogBox caste bekomme ich:</p>
<blockquote>
<p>c:\Proj\GHT\mdump\mdump.cpp(35) : error C2440: 'type cast' : cannot convert from 'overloaded-function' to 'DLGPROC'</p>
</blockquote>
<p>wie gesagt, wenn ich die DlgProc ausserhalb der Klasse ablege funktioniert es.<br />
Ich hoffe mir kann hierbei jemand helfen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/727102</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/727102</guid><dc:creator><![CDATA[cfk_zwei]]></dc:creator><pubDate>Sat, 19 Feb 2005 12:26:20 GMT</pubDate></item><item><title><![CDATA[Reply to DLGPROC als CALLBACK in einer Klasse on Sat, 19 Feb 2005 12:33:20 GMT]]></title><description><![CDATA[<p>in der forensuche &quot;wndproc klasse&quot; findest du die lösung <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/727106</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/727106</guid><dc:creator><![CDATA[miller_m]]></dc:creator><pubDate>Sat, 19 Feb 2005 12:33:20 GMT</pubDate></item><item><title><![CDATA[Reply to DLGPROC als CALLBACK in einer Klasse on Sat, 19 Feb 2005 12:46:27 GMT]]></title><description><![CDATA[<p>ok thx. Es hat lediglich das Schlüsseltwort &quot;static&quot; gefehlt <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/727116</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/727116</guid><dc:creator><![CDATA[cfk]]></dc:creator><pubDate>Sat, 19 Feb 2005 12:46:27 GMT</pubDate></item><item><title><![CDATA[Reply to DLGPROC als CALLBACK in einer Klasse on Sat, 19 Feb 2005 12:51:13 GMT]]></title><description><![CDATA[<p>cfk schrieb:</p>
<blockquote>
<p>ok thx. Es hat lediglich das Schlüsseltwort &quot;static&quot; gefehlt <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>
</blockquote>
<p>wenn man aber _nur_ static anwendet, hat man eine DWNDPROC für alle objekte</p>
]]></description><link>https://www.c-plusplus.net/forum/post/727121</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/727121</guid><dc:creator><![CDATA[net 0]]></dc:creator><pubDate>Sat, 19 Feb 2005 12:51:13 GMT</pubDate></item></channel></rss>