<?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[Wo ist der Fehler?]]></title><description><![CDATA[<p>Dieses Programm soll einfach nur piepen (MB_OK) wenn das Passwort &quot;Interkom&quot; eingegeben <a href="http://wurde.Es" rel="nofollow">wurde.Es</a> piept aber nicht.</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;

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

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

     wndclass.style         = CS_HREDRAW | CS_VREDRAW  ;
     wndclass.lpfnWndProc   = WndProc ;
     wndclass.cbClsExtra    = 0 ;
     wndclass.cbWndExtra    = 0 ;
     wndclass.hInstance     = hInstance ;
     wndclass.hIcon         = LoadIcon (NULL, IDI_EXCLAMATION) ;
     wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW) ;
     wndclass.hbrBackground = (HBRUSH) GetStockObject (LTGRAY_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 = CreateWindow (szAppName,                 // Name der Fensterklasse
                  TEXT (&quot;Das erste echte Programm&quot;),  // Fenstertitel
                  WS_OVERLAPPEDWINDOW,                // Fensterstil
                  CW_USEDEFAULT,                      // X-Position des Fensters
                  CW_USEDEFAULT,                      // Y-Position des Fensters
                  CW_USEDEFAULT,                      // Fensterbreite
                  CW_USEDEFAULT,                      // Fensterhöhe
                  NULL,                               // übergeordnetes Fenster
                  NULL,                               // Menü
                  hInstance,                          // Programm-Kopiezähler (Programm-ID)
                  NULL) ;                             // zusätzliche Parameter

     ShowWindow (hwnd, iCmdShow) ;
     UpdateWindow (hwnd) ;

     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)
{
     HDC         hdc ;
	 static HWND hEdit;
	 static HWND hButton;
     PAINTSTRUCT ps ;
     RECT        rect ;
	 const char  szText[] = &quot;Hallo, dies ist der Text.&quot;;
	 char static buffer[16];
	 const char pw[] = &quot;Interkom&quot;;

     switch (message)
     {
     case WM_CREATE:
		 {

		 hEdit = CreateWindowEx(WS_EX_CLIENTEDGE,
                                   &quot;edit&quot;,
                                   buffer,    // &lt;- das ist der Inhalt der Editfelds
                                   WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_MULTILINE |
                                              ES_AUTOVSCROLL,
                                   0, 0, 0, 0,
                                   hwnd,
                                   NULL,
                                   ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                   NULL);

		 hButton = CreateWindow(&quot;button&quot;,&quot;Login&quot;,
                                  WS_CHILD | WS_VISIBLE,
                                  0, 0, 0, 0,
                                  hwnd,
                                  NULL,
                                  ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                  NULL);

		 }

          return 0 ;

	 case WM_SIZE:
		 MoveWindow(hEdit, 0, 0, 100, 20, TRUE);
		 MoveWindow(hButton, 0, 20, 100, 20, TRUE);
		 return 0;

     case WM_PAINT:
          hdc = BeginPaint (hwnd, &amp;ps) ;

          GetClientRect (hwnd, &amp;rect) ;

          EndPaint (hwnd, &amp;ps) ;

		  return 0 ;

	 case WM_COMMAND:
		 {
         if (lParam == (LPARAM)hButton)
         {
            if (HIWORD(wParam) == BN_CLICKED)
			{
				if(buffer==pw)
					MessageBeep(MB_OK);
			}
         }
		 }
         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/123416/wo-ist-der-fehler</link><generator>RSS for Node</generator><lastBuildDate>Tue, 07 Jul 2026 19:10:08 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/123416.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 16 Oct 2005 17:13:21 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Wo ist der Fehler? on Sun, 16 Oct 2005 17:13:21 GMT]]></title><description><![CDATA[<p>Dieses Programm soll einfach nur piepen (MB_OK) wenn das Passwort &quot;Interkom&quot; eingegeben <a href="http://wurde.Es" rel="nofollow">wurde.Es</a> piept aber nicht.</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;

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

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

     wndclass.style         = CS_HREDRAW | CS_VREDRAW  ;
     wndclass.lpfnWndProc   = WndProc ;
     wndclass.cbClsExtra    = 0 ;
     wndclass.cbWndExtra    = 0 ;
     wndclass.hInstance     = hInstance ;
     wndclass.hIcon         = LoadIcon (NULL, IDI_EXCLAMATION) ;
     wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW) ;
     wndclass.hbrBackground = (HBRUSH) GetStockObject (LTGRAY_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 = CreateWindow (szAppName,                 // Name der Fensterklasse
                  TEXT (&quot;Das erste echte Programm&quot;),  // Fenstertitel
                  WS_OVERLAPPEDWINDOW,                // Fensterstil
                  CW_USEDEFAULT,                      // X-Position des Fensters
                  CW_USEDEFAULT,                      // Y-Position des Fensters
                  CW_USEDEFAULT,                      // Fensterbreite
                  CW_USEDEFAULT,                      // Fensterhöhe
                  NULL,                               // übergeordnetes Fenster
                  NULL,                               // Menü
                  hInstance,                          // Programm-Kopiezähler (Programm-ID)
                  NULL) ;                             // zusätzliche Parameter

     ShowWindow (hwnd, iCmdShow) ;
     UpdateWindow (hwnd) ;

     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)
{
     HDC         hdc ;
	 static HWND hEdit;
	 static HWND hButton;
     PAINTSTRUCT ps ;
     RECT        rect ;
	 const char  szText[] = &quot;Hallo, dies ist der Text.&quot;;
	 char static buffer[16];
	 const char pw[] = &quot;Interkom&quot;;

     switch (message)
     {
     case WM_CREATE:
		 {

		 hEdit = CreateWindowEx(WS_EX_CLIENTEDGE,
                                   &quot;edit&quot;,
                                   buffer,    // &lt;- das ist der Inhalt der Editfelds
                                   WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_MULTILINE |
                                              ES_AUTOVSCROLL,
                                   0, 0, 0, 0,
                                   hwnd,
                                   NULL,
                                   ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                   NULL);

		 hButton = CreateWindow(&quot;button&quot;,&quot;Login&quot;,
                                  WS_CHILD | WS_VISIBLE,
                                  0, 0, 0, 0,
                                  hwnd,
                                  NULL,
                                  ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                  NULL);

		 }

          return 0 ;

	 case WM_SIZE:
		 MoveWindow(hEdit, 0, 0, 100, 20, TRUE);
		 MoveWindow(hButton, 0, 20, 100, 20, TRUE);
		 return 0;

     case WM_PAINT:
          hdc = BeginPaint (hwnd, &amp;ps) ;

          GetClientRect (hwnd, &amp;rect) ;

          EndPaint (hwnd, &amp;ps) ;

		  return 0 ;

	 case WM_COMMAND:
		 {
         if (lParam == (LPARAM)hButton)
         {
            if (HIWORD(wParam) == BN_CLICKED)
			{
				if(buffer==pw)
					MessageBeep(MB_OK);
			}
         }
		 }
         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/893611</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/893611</guid><dc:creator><![CDATA[Leon++]]></dc:creator><pubDate>Sun, 16 Oct 2005 17:13:21 GMT</pubDate></item><item><title><![CDATA[Reply to Wo ist der Fehler? on Sun, 16 Oct 2005 17:15:17 GMT]]></title><description><![CDATA[<p>Das liegt daran, dass du Arrays nicht inhaltlich mit == vergleichen kannst. Dabei werden nur die Adressen verglichen, und das ergibt bei dir immer false.</p>
<p>Stichwort: strcmp.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/893614</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/893614</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Sun, 16 Oct 2005 17:15:17 GMT</pubDate></item><item><title><![CDATA[Reply to Wo ist der Fehler? on Sun, 16 Oct 2005 18:36:42 GMT]]></title><description><![CDATA[<p>weisst du buffer ueberhaupt irgendwo den wert aus deinem editcontrol zu? oder hab ich mich da verguckt??</p>
]]></description><link>https://www.c-plusplus.net/forum/post/893688</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/893688</guid><dc:creator><![CDATA[Moh]]></dc:creator><pubDate>Sun, 16 Oct 2005 18:36:42 GMT</pubDate></item><item><title><![CDATA[Reply to Wo ist der Fehler? on Mon, 17 Oct 2005 07:47:12 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">case WM_COMMAND: 
{ 
	if (lParam == (LPARAM)hButton) 
	{ 
		if (HIWORD(wParam) == BN_CLICKED) 
		{
			GetWindowText( hEdit, buffer, 15 );

			if( strcmp( buffer, pw ) == 0 )
				MessageBeep( 1 );
		} 
	} 
} 
return 0;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/893875</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/893875</guid><dc:creator><![CDATA[Airdamn]]></dc:creator><pubDate>Mon, 17 Oct 2005 07:47:12 GMT</pubDate></item></channel></rss>