<?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 MessageBox()]]></title><description><![CDATA[<p>Hallo zusammen!</p>
<p>Hier mein Code zum besseren Verständnis:</p>
<pre><code>BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
   HWND hWnd;

   hInst = hInstance; // Instanzenhandle in der globalen Variablen speichern

   hWnd = CreateDialogW(hInst,(LPCWSTR) IDD_MAIN, NULL, (DLGPROC) WndProc);

   if (!hWnd)
   {
      return FALSE;
   }

   ShowWindow(hWnd, nCmdShow);
   UpdateWindow(hWnd);

   return TRUE;
}

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	int wmId, wmEvent;
	PAINTSTRUCT ps;
	HDC hdc;

	switch (message)
	{
	case WM_COMMAND:
		wmId    = LOWORD(wParam);
		wmEvent = HIWORD(wParam);
		// Menüauswahl bearbeiten:
		switch (wmId)
		{
		case ID_TEST:
			MessageBox(NULL, L&quot;Hallo&quot;,L&quot;Test&quot;,MB_OK); // &lt;&lt;&lt;&lt;&lt; Darum geht's
			break;

[...]
</code></pre>
<p>Die MessageBox, die in der gekennzeichneten Zeile aufgerufen wird, nimmt keine Befehle an und ich weiß nicht wieso. Das ist aber nur der Fall, wenn sie innerhalb dieser &quot;switch&quot; Anweisung aufgerufen wird. Ich kann weder den &quot;OK&quot; Button drücken, noch funktioniert das X zum schließen. Anscheinend hängt das ganze aber damit zusammen, dass die Anwendung als Hauptfenster eine Dialogbox verwendet.</p>
<p>Hat jemand einen Tip, wie ich das Problem lösen bzw. umgehen kann?</p>
<p>Danke schon mal im Voraus,<br />
veryxRV</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/189929/problem-mit-messagebox</link><generator>RSS for Node</generator><lastBuildDate>Thu, 02 Jul 2026 06:13:21 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/189929.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 18 Aug 2007 17:24:16 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem mit MessageBox() on Sat, 18 Aug 2007 17:24:16 GMT]]></title><description><![CDATA[<p>Hallo zusammen!</p>
<p>Hier mein Code zum besseren Verständnis:</p>
<pre><code>BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
   HWND hWnd;

   hInst = hInstance; // Instanzenhandle in der globalen Variablen speichern

   hWnd = CreateDialogW(hInst,(LPCWSTR) IDD_MAIN, NULL, (DLGPROC) WndProc);

   if (!hWnd)
   {
      return FALSE;
   }

   ShowWindow(hWnd, nCmdShow);
   UpdateWindow(hWnd);

   return TRUE;
}

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	int wmId, wmEvent;
	PAINTSTRUCT ps;
	HDC hdc;

	switch (message)
	{
	case WM_COMMAND:
		wmId    = LOWORD(wParam);
		wmEvent = HIWORD(wParam);
		// Menüauswahl bearbeiten:
		switch (wmId)
		{
		case ID_TEST:
			MessageBox(NULL, L&quot;Hallo&quot;,L&quot;Test&quot;,MB_OK); // &lt;&lt;&lt;&lt;&lt; Darum geht's
			break;

[...]
</code></pre>
<p>Die MessageBox, die in der gekennzeichneten Zeile aufgerufen wird, nimmt keine Befehle an und ich weiß nicht wieso. Das ist aber nur der Fall, wenn sie innerhalb dieser &quot;switch&quot; Anweisung aufgerufen wird. Ich kann weder den &quot;OK&quot; Button drücken, noch funktioniert das X zum schließen. Anscheinend hängt das ganze aber damit zusammen, dass die Anwendung als Hauptfenster eine Dialogbox verwendet.</p>
<p>Hat jemand einen Tip, wie ich das Problem lösen bzw. umgehen kann?</p>
<p>Danke schon mal im Voraus,<br />
veryxRV</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1347028</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1347028</guid><dc:creator><![CDATA[veryxRV]]></dc:creator><pubDate>Sat, 18 Aug 2007 17:24:16 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit MessageBox() on Sun, 19 Aug 2007 07:10:48 GMT]]></title><description><![CDATA[<p>setz doch ma n breakpoint und schau ob du beim switch ueberhaupt ankommst</p>
<p>ps. ich selber machs immer so das ich variablen nur deklarieren lass wenn ich sie auch brauch, so kannst du zb die<br />
int wmId, wmEvent;<br />
PAINTSTRUCT ps;<br />
HDC hdc;<br />
getrost weglassen und erst deklarieren wenn du sie brauchst, zuden kannst du LOWORD(wParam) usw auch ohne die int benutzen</p>
<p>//dazuedit, zeig auch mal mitte deinen ganzen switch zweig, hast du ein default?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1347181</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1347181</guid><dc:creator><![CDATA[EXDW]]></dc:creator><pubDate>Sun, 19 Aug 2007 07:10:48 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit MessageBox() on Sun, 19 Aug 2007 08:05:11 GMT]]></title><description><![CDATA[<p>Um Genaueres zu sagen, bräuchte man etwas mehr Code.<br />
Wie sieht die Auswertung der MessageBox aus?<br />
Wird die MessageBox vom Dialog oder vom Hauptfenster aufgerufen? Durch die NULL im HWND-Parameter der MessageBox hat die MessageBox gar kein Eltern-Fenster. So weiß das Programm gar nicht, wo es die MessageBox zuordnen soll.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1347191</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1347191</guid><dc:creator><![CDATA[Elektronix]]></dc:creator><pubDate>Sun, 19 Aug 2007 08:05:11 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit MessageBox() on Sun, 19 Aug 2007 13:17:43 GMT]]></title><description><![CDATA[<p>Wie oft ich den Fehler jetzt schon gesehen hab...:</p>
<pre><code class="language-cpp">hWnd = CreateDialogW(hInst,(LPCWSTR) IDD_MAIN, NULL, (DLGPROC) WndProc);
</code></pre>
<p>Hättest Du das nicht gecastet, wär Dir wahrscheinlich aufgefallen, dass die Syntax für eine Dialog-Prozedur so aussieht:</p>
<pre><code class="language-cpp">INT_PTR CALLBACK DlgProc(HWND hWnd, UINT uiMessage, WPARAM wParam, LPARAM lParam);
</code></pre>
<p>Falls Du eine Nachricht bearbeitet hast: <code>return (TRUE);</code> , andernfalls <code>return (FALSE);</code> !</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1347394</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1347394</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Sun, 19 Aug 2007 13:17:43 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit MessageBox() on Mon, 20 Aug 2007 07:36:34 GMT]]></title><description><![CDATA[<p>CodeFinder schrieb:</p>
<blockquote>
<p>Wie oft ich den Fehler jetzt schon gesehen hab...:</p>
<pre><code class="language-cpp">hWnd = CreateDialogW(hInst,(LPCWSTR) IDD_MAIN, NULL, (DLGPROC) WndProc);
</code></pre>
</blockquote>
<p>Komisch. Hab gerade mal im Petzold nachgeschaut, der macht das auch so. Ist das neu?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1347895</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1347895</guid><dc:creator><![CDATA[Elektronix]]></dc:creator><pubDate>Mon, 20 Aug 2007 07:36:34 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit MessageBox() on Mon, 20 Aug 2007 08:04:33 GMT]]></title><description><![CDATA[<p><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="😕"
    /> ne eigentlich nich neu! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1347916</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1347916</guid><dc:creator><![CDATA[Ascharan]]></dc:creator><pubDate>Mon, 20 Aug 2007 08:04:33 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit MessageBox() on Mon, 20 Aug 2007 08:23:09 GMT]]></title><description><![CDATA[<p>Mißverständnis. Ich meinte, ob CodeFinders Methode neu ist, wo doch der Petzold <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="😕"
    /> ... naja ihr wißt schon... <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>
<p>CodeFinder schrieb:</p>
<blockquote>
<pre><code class="language-cpp">INT_PTR CALLBACK DlgProc(HWND hWnd, UINT uiMessage, WPARAM wParam, LPARAM lParam);
</code></pre>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1347934</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1347934</guid><dc:creator><![CDATA[Elektronix]]></dc:creator><pubDate>Mon, 20 Aug 2007 08:23:09 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit MessageBox() on Mon, 20 Aug 2007 08:29:23 GMT]]></title><description><![CDATA[<p>definiere Neu ?<br />
denn das buch hat scho ein paar jahre hinter sich und sind so einige änderungen seit dem hinzugekommen ,unterdessen steht im fast jedem tut ob alt oder neu die methode von CodeFinder <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1347939</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1347939</guid><dc:creator><![CDATA[Ascharan]]></dc:creator><pubDate>Mon, 20 Aug 2007 08:29:23 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit MessageBox() on Mon, 20 Aug 2007 08:47:16 GMT]]></title><description><![CDATA[<p><a href="http://Winapi.de" rel="nofollow">Winapi.de</a> schrieb:</p>
<blockquote>
<p>LRESULT CALLBACK ChildProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)<br />
LRESULT CALLBACK CheckProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)</p>
</blockquote>
<p><a href="http://pronix.linuxdelta.de/C/win32/win32_5.shtml" rel="nofollow">http://pronix.linuxdelta.de/C/win32/win32_5.shtml</a> schrieb:</p>
<blockquote>
<p>LRESULT CALLBACK CheckRadioProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )<br />
LRESULT CALLBACK CheckEditProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )<br />
LRESULT CALLBACK CheckListboxProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )<br />
{</p>
</blockquote>
<p><a href="http://www.winapi.net/index.php?inhalt=s8" rel="nofollow">http://www.winapi.net/index.php?inhalt=s8</a> schrieb:</p>
<blockquote>
<p>BOOL CALLBACK DialogProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)</p>
</blockquote>
<p><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="😕"
    /> <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="😕"
    /> <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="😕"
    /><br />
Seit wann ist denn CodeFinders Methode gültig? Und was bewirkt sie im Vergleich zu der alten Schreibweise?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1347954</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1347954</guid><dc:creator><![CDATA[Elektronix]]></dc:creator><pubDate>Mon, 20 Aug 2007 08:47:16 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit MessageBox() on Mon, 20 Aug 2007 08:50:06 GMT]]></title><description><![CDATA[<pre><code>INT_PTR CALLBACK DlgProc(HWND hWnd, UINT uiMessage, WPARAM wParam, LPARAM lParam);
</code></pre>
<p>Jeder machts anders ???????</p>
<p>naja wenn ich ne nachrichten prozedure erstelle fürn Dialog nehm ich</p>
<pre><code>INT_PTR CALLBACK DlgProc(HWND hWnd, UINT uiMessage, WPARAM wParam, LPARAM
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1347966</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1347966</guid><dc:creator><![CDATA[Ascharan]]></dc:creator><pubDate>Mon, 20 Aug 2007 08:50:06 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit MessageBox() on Mon, 20 Aug 2007 13:56:14 GMT]]></title><description><![CDATA[<p>INT_PTR .... ist schon richtig, wird aber als true/false verwendet, somit geht auch bool ....</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1348323</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1348323</guid><dc:creator><![CDATA[orr lol]]></dc:creator><pubDate>Mon, 20 Aug 2007 13:56:14 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit MessageBox() on Mon, 20 Aug 2007 14:40:25 GMT]]></title><description><![CDATA[<p>Elektronix schrieb:</p>
<blockquote>
<p>Seit wann ist denn CodeFinders Methode gültig? Und was bewirkt sie im Vergleich zu der alten Schreibweise?</p>
</blockquote>
<p>Einfach nur in den Headern nachgucken. Auf/Unter &quot;Win32&quot; bewirkt sie nichts :</p>
<pre><code class="language-cpp">----------------------
INT_PTR -&gt; BaseTsd.h :
----------------------
#if defined(_WIN64) 
 typedef __int64 INT_PTR; 
#else 
 typedef int INT_PTR;        // &lt;- !
#endif
----------------------
BOOL -&gt; WinDef.h :
----------------------
typedef int BOOL;            // &lt;- !
</code></pre>
<p>Bei einer DialogProc soll nur true oder false zurückgegeben werden.<br />
Bei einer WindowProc kann aber je nach WM_xxxx auch z.B. ein Handle zurückgegeben werden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1348363</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1348363</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Mon, 20 Aug 2007 14:40:25 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit MessageBox() on Mon, 20 Aug 2007 15:09:06 GMT]]></title><description><![CDATA[<p>Huh, was für ein Tumult ich hier ausgelößt habe <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /> ...also der Petzold ist schon etwas älter und so genommen ist es 'neuer'. Der Sinn der Sache ist, dass Eure DlgProc's dann auch auf einem späteren 64-Bit-Rechner funktionieren (nativ). Dafür muss man dann zwar neukompilieren, aber nichts am Quellcodeändern.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1348391</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1348391</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Mon, 20 Aug 2007 15:09:06 GMT</pubDate></item></channel></rss>