<?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[Dialog als Hauptanwendung]]></title><description><![CDATA[<p>hey<br />
ich habe einen Dialog als ressource hinzugefügt und ihn<br />
mit CreateDialog erzeugt. Der Dialog erscheint zwar aber er macht überhaupt nix.<br />
Er reagiert mit einem klick auf schließen (kreuz) überhaupt nicht und auf andere Messages auch nicht. Woran liegt das? Muss ich irgendwie angeben das WndProc seine Prozedur ist?</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &quot;resource.h&quot;

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

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                    PSTR szCmdLine, int iCmdShow)
{
     static TCHAR szAppName[] = TEXT (&quot;Dialog als Hauptanwendung&quot;) ;
     HWND         hwnd ;
     MSG          msg ;
     WNDCLASS     wndclass ;

     wndclass.style         = CS_HREDRAW | CS_VREDRAW ;
     wndclass.lpfnWndProc   = WndProc ;
     wndclass.cbClsExtra    = 0 ;
     wndclass.cbWndExtra    = DLGWINDOWEXTRA ;
     wndclass.hInstance     = hInstance ;
     wndclass.hIcon         = LoadIcon (NULL, IDI_APPLICATION) ;
     wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW) ;
     wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
     wndclass.lpszMenuName  = NULL ;
     wndclass.lpszClassName = szAppName ;

     if (!RegisterClass (&amp;wndclass))
     {    // UNICODE-Compilierung ist die einzige realistische Fehlermöglichkeit 
          MessageBox (NULL, TEXT (&quot;Programm arbeitet mit Unicode und setzt Windows NT voraus!&quot;), 
                      szAppName, MB_ICONERROR) ;
          return 0 ;
     }

     hwnd = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), 0, 0);

     ShowWindow (hwnd, iCmdShow) ;

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

LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{

     switch (message)
     {
     case WM_CREATE:
          return 0 ;

     case WM_DESTROY:
          PostQuitMessage (0) ;
          return 0 ;
     }
     return DefWindowProc (hwnd, message, wParam, lParam) ;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/220400/dialog-als-hauptanwendung</link><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Apr 2026 14:00:08 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/220400.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 15 Aug 2008 14:13:10 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Dialog als Hauptanwendung on Fri, 15 Aug 2008 14:13:10 GMT]]></title><description><![CDATA[<p>hey<br />
ich habe einen Dialog als ressource hinzugefügt und ihn<br />
mit CreateDialog erzeugt. Der Dialog erscheint zwar aber er macht überhaupt nix.<br />
Er reagiert mit einem klick auf schließen (kreuz) überhaupt nicht und auf andere Messages auch nicht. Woran liegt das? Muss ich irgendwie angeben das WndProc seine Prozedur ist?</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &quot;resource.h&quot;

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

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                    PSTR szCmdLine, int iCmdShow)
{
     static TCHAR szAppName[] = TEXT (&quot;Dialog als Hauptanwendung&quot;) ;
     HWND         hwnd ;
     MSG          msg ;
     WNDCLASS     wndclass ;

     wndclass.style         = CS_HREDRAW | CS_VREDRAW ;
     wndclass.lpfnWndProc   = WndProc ;
     wndclass.cbClsExtra    = 0 ;
     wndclass.cbWndExtra    = DLGWINDOWEXTRA ;
     wndclass.hInstance     = hInstance ;
     wndclass.hIcon         = LoadIcon (NULL, IDI_APPLICATION) ;
     wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW) ;
     wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
     wndclass.lpszMenuName  = NULL ;
     wndclass.lpszClassName = szAppName ;

     if (!RegisterClass (&amp;wndclass))
     {    // UNICODE-Compilierung ist die einzige realistische Fehlermöglichkeit 
          MessageBox (NULL, TEXT (&quot;Programm arbeitet mit Unicode und setzt Windows NT voraus!&quot;), 
                      szAppName, MB_ICONERROR) ;
          return 0 ;
     }

     hwnd = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), 0, 0);

     ShowWindow (hwnd, iCmdShow) ;

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

LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{

     switch (message)
     {
     case WM_CREATE:
          return 0 ;

     case WM_DESTROY:
          PostQuitMessage (0) ;
          return 0 ;
     }
     return DefWindowProc (hwnd, message, wParam, lParam) ;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1565518</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1565518</guid><dc:creator><![CDATA[Dialogo]]></dc:creator><pubDate>Fri, 15 Aug 2008 14:13:10 GMT</pubDate></item><item><title><![CDATA[Reply to Dialog als Hauptanwendung on Fri, 15 Aug 2008 14:29:37 GMT]]></title><description><![CDATA[<p><a href="http://msdn.microsoft.com/en-us/library/ms645434.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms645434.aspx</a> sollte weiterhelfen (insbesondere die Bedeutung des letzten Parameters).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1565531</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1565531</guid><dc:creator><![CDATA[sri]]></dc:creator><pubDate>Fri, 15 Aug 2008 14:29:37 GMT</pubDate></item><item><title><![CDATA[Reply to Dialog als Hauptanwendung on Fri, 15 Aug 2008 14:42:19 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &quot;resource.h&quot;

LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;
INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                    PSTR szCmdLine, int iCmdShow)
{
     static TCHAR szAppName[] = TEXT (&quot;Dialog als Hauptanwendung&quot;) ;
     HWND         hwnd ;
     MSG          msg ;
     WNDCLASS     wndclass ;

     wndclass.style         = CS_HREDRAW | CS_VREDRAW ;
     wndclass.lpfnWndProc   = WndProc ;
     wndclass.cbClsExtra    = 0 ;
     wndclass.cbWndExtra    = DLGWINDOWEXTRA ;
     wndclass.hInstance     = hInstance ;
     wndclass.hIcon         = LoadIcon (NULL, IDI_APPLICATION) ;
     wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW) ;
     wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
     wndclass.lpszMenuName  = NULL ;
     wndclass.lpszClassName = szAppName ;

     if (!RegisterClass (&amp;wndclass))
     {    // UNICODE-Compilierung ist die einzige realistische Fehlermöglichkeit 
          MessageBox (NULL, TEXT (&quot;Programm arbeitet mit Unicode und setzt Windows NT voraus!&quot;), 
                      szAppName, MB_ICONERROR) ;
          return 0 ;
     }

     hwnd = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), 0, DialogProc);

     ShowWindow (hwnd, iCmdShow) ;

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

LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{

     switch (message)
     {
     case WM_CREATE:
          return 0 ;

     case WM_DESTROY:
          PostQuitMessage (0) ;
          return 0 ;
     }
     return DefWindowProc (hwnd, message, wParam, lParam) ;
}

INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch(uMsg)
	{
    case WM_DESTROY:
         PostQuitMessage (0) ;
         return 0 ;
	}
    return false;
}
</code></pre>
<p>so weit bin ich schon leider wird das programm immernoch nicht beendet und reagiert nicht wirklich was ist noch falsch?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1565548</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1565548</guid><dc:creator><![CDATA[dialog]]></dc:creator><pubDate>Fri, 15 Aug 2008 14:42:19 GMT</pubDate></item><item><title><![CDATA[Reply to Dialog als Hauptanwendung on Fri, 15 Aug 2008 14:59:20 GMT]]></title><description><![CDATA[<p>Wenn soll er darauf reagieren soll, solltest du es vielleicht auch in der DlgProc behandeln....</p>
<pre><code class="language-cpp">case WM_COMMAND:
		switch(LOWORD(wParam)) {
			case IDOK:
			case IDCANCEL:
				EndDialog(hwndDlg, 0);
				return TRUE;
		}
		break;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1565569</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1565569</guid><dc:creator><![CDATA[doc.dope]]></dc:creator><pubDate>Fri, 15 Aug 2008 14:59:20 GMT</pubDate></item><item><title><![CDATA[Reply to Dialog als Hauptanwendung on Fri, 15 Aug 2008 15:04:36 GMT]]></title><description><![CDATA[<p>danke jetz gehts und noch ne frage.<br />
kann ich die andere Prozedor das registrieren der fenster klasse usw löschen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1565576</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1565576</guid><dc:creator><![CDATA[dialog]]></dc:creator><pubDate>Fri, 15 Aug 2008 15:04:36 GMT</pubDate></item><item><title><![CDATA[Reply to Dialog als Hauptanwendung on Fri, 15 Aug 2008 15:12:32 GMT]]></title><description><![CDATA[<p>Ja. Wenn du den Dialog modeless mit CreateDialog erstellst, brauchst du aber trotzdem noch die GetMessage Schleife. Benutz ansonsten DialogBox statt CreateDialog.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1565583</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1565583</guid><dc:creator><![CDATA[doc.dope]]></dc:creator><pubDate>Fri, 15 Aug 2008 15:12:32 GMT</pubDate></item><item><title><![CDATA[Reply to Dialog als Hauptanwendung on Fri, 15 Aug 2008 15:16:18 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &quot;resource.h&quot;

INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                    PSTR szCmdLine, int iCmdShow)
{
     static TCHAR szAppName[] = TEXT (&quot;Dialog als Hauptanwendung&quot;) ;
     HWND         hwnd ;
     MSG          msg ;

     hwnd = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), 0, DialogProc);
     ShowWindow (hwnd, iCmdShow) ;

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

INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch(uMsg)
	{
    case WM_COMMAND:
         switch(LOWORD(wParam)) {
	        case IDC_BUTTON1:
				 Beep(2000, 5000);
				 return 0;
            case IDOK:
				 return 0;
            case IDCANCEL:
                EndDialog(hwndDlg, 0);
				PostQuitMessage(0);
                return 0;
        }
        break;
	}
    return false;
}
</code></pre>
<p>Soweit bin ich jetzt schon. Warum brauche ich die GetMesage schleife?<br />
die MSG ist doch eh nicht definiert was soll das bringen??</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1565589</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1565589</guid><dc:creator><![CDATA[dialog]]></dc:creator><pubDate>Fri, 15 Aug 2008 15:16:18 GMT</pubDate></item><item><title><![CDATA[Reply to Dialog als Hauptanwendung on Tue, 19 Aug 2008 13:15:21 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>dialog schrieb:</p>
<blockquote>
<p>Warum brauche ich die GetMesage schleife?</p>
</blockquote>
<p>Entferne sie, und du wirst wissen, ob du sie benötigst.</p>
<p>MfG,</p>
<p>Probe-Nutzer</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1567560</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1567560</guid><dc:creator><![CDATA[Probe-Nutzer]]></dc:creator><pubDate>Tue, 19 Aug 2008 13:15:21 GMT</pubDate></item><item><title><![CDATA[Reply to Dialog als Hauptanwendung on Tue, 19 Aug 2008 18:14:41 GMT]]></title><description><![CDATA[<p>Du brauchst keine Schelife... mach einfach:</p>
<pre><code class="language-cpp">int WINAPI WinMain (
  HINSTANCE hInstance, 
  HINSTANCE hPrevInstance, 
  PSTR szCmdLine, 
  int iCmdShow)
{
  DialogBox(...);
  return;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1567788</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1567788</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Tue, 19 Aug 2008 18:14:41 GMT</pubDate></item></channel></rss>