<?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[Button wird gedoppelt]]></title><description><![CDATA[<p>Hallo Leute,</p>
<p>ich habe gerade mit den Win-APIs angefangen und spiele ein wenig mit den Möglichkeiten herum; jetzt habe ich folgendes Problem:<br />
Wenn ich die beiden Childs erzeuge (siehe Unten) wird &quot;button&quot; im Parentfenster aber auch im zweiten Childfenster dargestellt.<br />
Wie kann das ändern und zwar so, dass &quot;button&quot; nur noch im Parentfenster gezeigt wird?<br />
____________________________________________________________________________</p>
<pre><code class="language-cpp">#include &quot;stdafx.h&quot;
#include &lt;windows.h&gt;

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

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, 
                   PSTR szCmdLine, int iCmdShow)
{
   MSG        msg;
   HWND       hWnd;
   WNDCLASS   wc;

   const char szAppName[]  = &quot;Windows Buttons&quot;;

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

   RegisterClass(&amp;wc);

   wc.hbrBackground			=(HBRUSH) GetStockObject(WHITE_BRUSH);
   wc.hIcon                 = NULL;
   wc.lpszClassName			= &quot;screen1&quot;;

   RegisterClass(&amp;wc);

   hWnd = CreateWindow(    szAppName,
                           szAppName,
                           WS_OVERLAPPEDWINDOW,
                           CW_USEDEFAULT,
                           CW_USEDEFAULT,
                           CW_USEDEFAULT,
                           CW_USEDEFAULT,
                           NULL,
                           NULL,
                           hInstance,
                           NULL);

   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)
{
   static HWND hButton,hScreen1;

   switch (message)
   {
   case WM_CREATE:
      {
				hScreen1 = CreateWindow(  &quot;screen1&quot;,
                                  NULL,
                                  WS_CHILD | WS_VISIBLE,
                                  100, 
								  100, 
								  300, 
								  100,
                                  hWnd,
                                  NULL,
                                  ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                  NULL);

				hButton = CreateWindow(  &quot;button&quot;,
                                  &quot;ZOOM&quot;,
                                  WS_CHILD | WS_VISIBLE,
                                  0,0, 50, 30,
                                  hWnd,
                                  NULL,
                                  ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                  NULL);

			return 0;
      }

    case WM_SIZE:
      {

		MoveWindow(hScreen1,110,150,100,100, TRUE);
        MoveWindow(hButton,0,0, 50, 30, TRUE);

        return 0;
      }

	case WM_COMMAND:
      {
         if (lParam == (LPARAM)hButton)
         {
            if (HIWORD(wParam) == BN_CLICKED)
               SendMessage(hWnd, WM_CLOSE, 0, 0);
         }
         return 0;
      }

   case WM_DESTROY:
      {
         PostQuitMessage(0);
         return 0;
      }

   }
   return DefWindowProc(hWnd, message, wParam, lParam);
}
</code></pre>
<p>_______________________________________________________________________________</p>
<p>Vielen Dank vorweg</p>
<p>globalplayer</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/86817/button-wird-gedoppelt</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Apr 2026 16:35:17 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/86817.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 22 Sep 2004 17:54:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Button wird gedoppelt on Wed, 22 Sep 2004 18:34:08 GMT]]></title><description><![CDATA[<p>Hallo Leute,</p>
<p>ich habe gerade mit den Win-APIs angefangen und spiele ein wenig mit den Möglichkeiten herum; jetzt habe ich folgendes Problem:<br />
Wenn ich die beiden Childs erzeuge (siehe Unten) wird &quot;button&quot; im Parentfenster aber auch im zweiten Childfenster dargestellt.<br />
Wie kann das ändern und zwar so, dass &quot;button&quot; nur noch im Parentfenster gezeigt wird?<br />
____________________________________________________________________________</p>
<pre><code class="language-cpp">#include &quot;stdafx.h&quot;
#include &lt;windows.h&gt;

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

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, 
                   PSTR szCmdLine, int iCmdShow)
{
   MSG        msg;
   HWND       hWnd;
   WNDCLASS   wc;

   const char szAppName[]  = &quot;Windows Buttons&quot;;

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

   RegisterClass(&amp;wc);

   wc.hbrBackground			=(HBRUSH) GetStockObject(WHITE_BRUSH);
   wc.hIcon                 = NULL;
   wc.lpszClassName			= &quot;screen1&quot;;

   RegisterClass(&amp;wc);

   hWnd = CreateWindow(    szAppName,
                           szAppName,
                           WS_OVERLAPPEDWINDOW,
                           CW_USEDEFAULT,
                           CW_USEDEFAULT,
                           CW_USEDEFAULT,
                           CW_USEDEFAULT,
                           NULL,
                           NULL,
                           hInstance,
                           NULL);

   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)
{
   static HWND hButton,hScreen1;

   switch (message)
   {
   case WM_CREATE:
      {
				hScreen1 = CreateWindow(  &quot;screen1&quot;,
                                  NULL,
                                  WS_CHILD | WS_VISIBLE,
                                  100, 
								  100, 
								  300, 
								  100,
                                  hWnd,
                                  NULL,
                                  ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                  NULL);

				hButton = CreateWindow(  &quot;button&quot;,
                                  &quot;ZOOM&quot;,
                                  WS_CHILD | WS_VISIBLE,
                                  0,0, 50, 30,
                                  hWnd,
                                  NULL,
                                  ((LPCREATESTRUCT) lParam) -&gt; hInstance,
                                  NULL);

			return 0;
      }

    case WM_SIZE:
      {

		MoveWindow(hScreen1,110,150,100,100, TRUE);
        MoveWindow(hButton,0,0, 50, 30, TRUE);

        return 0;
      }

	case WM_COMMAND:
      {
         if (lParam == (LPARAM)hButton)
         {
            if (HIWORD(wParam) == BN_CLICKED)
               SendMessage(hWnd, WM_CLOSE, 0, 0);
         }
         return 0;
      }

   case WM_DESTROY:
      {
         PostQuitMessage(0);
         return 0;
      }

   }
   return DefWindowProc(hWnd, message, wParam, lParam);
}
</code></pre>
<p>_______________________________________________________________________________</p>
<p>Vielen Dank vorweg</p>
<p>globalplayer</p>
]]></description><link>https://www.c-plusplus.net/forum/post/613104</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/613104</guid><dc:creator><![CDATA[globalplayer]]></dc:creator><pubDate>Wed, 22 Sep 2004 18:34:08 GMT</pubDate></item><item><title><![CDATA[Reply to Button wird gedoppelt on Wed, 22 Sep 2004 18:10:58 GMT]]></title><description><![CDATA[<p>globalplayer schrieb:</p>
<blockquote>
<p>Wenn ich die beiden Childs erzeuge (siehe Unten) wird &quot;button&quot; im Parentfenster aber auch im zweiten Childfenster dargestellt.<br />
Wie kann das ändern und zwar so, dass &quot;button&quot; nur noch im Parentfenster gezeigt wird?</p>
</blockquote>
<p>Ich verstehe irgendwie nicht so ganz, was du meinst - habe aber leider gerade auch main VC++ nicht installiert, um es kurz zu testen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/613113</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/613113</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Wed, 22 Sep 2004 18:10:58 GMT</pubDate></item><item><title><![CDATA[Reply to Button wird gedoppelt on Wed, 22 Sep 2004 18:25:49 GMT]]></title><description><![CDATA[<p>Ok, ich versuchs nochmal:<br />
AAAAAAAAlso es ist so: Ich habe ein Hauptfenster; in dieses soll oben Rechts ein Button und darunter ein weiteres Fenster; Button und weiteres Fenster sind Child; so <strong>soll</strong> es sein.<br />
Tatsächlich schaut die Ausgabe aber so aus:<br />
Ich habe das Hauptfenster und den Button oben Rechts, sowie das weitere Child-Fenster - soweit ist alles so, wie ich es haben will.<br />
Es ist nur so, das im Child-Fenster der Button <strong>noch mal</strong> erscheint und zwar relativ gesehen an der gleichen Stelle, wie im Hauptfenster, also oben rechts und diesen Button im Childfenster kann ich mir nicht erklären!</p>
<p>Ich hoffe es ist etwas klarer jetzt<br />
globalplayer</p>
]]></description><link>https://www.c-plusplus.net/forum/post/613130</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/613130</guid><dc:creator><![CDATA[globalplayer]]></dc:creator><pubDate>Wed, 22 Sep 2004 18:25:49 GMT</pubDate></item><item><title><![CDATA[Reply to Button wird gedoppelt on Wed, 22 Sep 2004 19:28:13 GMT]]></title><description><![CDATA[<p>Achso, sehe es jetzt erst: screen1 hat die selbe WndProc - also wird dort nochmal in WM_CREATE ein Button erzeugt <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="😉"
    /><br />
Eigentlich müsste sich das sogar unendlich fortsetzen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/613172</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/613172</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Wed, 22 Sep 2004 19:28:13 GMT</pubDate></item><item><title><![CDATA[Reply to Button wird gedoppelt on Wed, 22 Sep 2004 19:56:52 GMT]]></title><description><![CDATA[<p>Ja stimmt, ich habe das Programm noch eimal modifiziert und seit dem habe ich genug Buttons um über den Winter zu kommen. <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="😃"
    /><br />
Aber egal... um diese Endlosschleife aufzulösen muß ich also für eines der Childfenster einen anderen Wert für &quot;lpfnWndProc&quot; einsetzen und diese Callback-Funktion natürlich auch definieren. Habe ich das richtig verstanden?</p>
<p>globalplayer<br />
**<br />
PS<br />
Vielen Dank für die schnell und gute Hilfe flenders, das Programm funktioniert jetzt!<br />
**</p>
]]></description><link>https://www.c-plusplus.net/forum/post/613193</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/613193</guid><dc:creator><![CDATA[globalplayer]]></dc:creator><pubDate>Wed, 22 Sep 2004 19:56:52 GMT</pubDate></item><item><title><![CDATA[Reply to Button wird gedoppelt on Thu, 23 Sep 2004 07:45:25 GMT]]></title><description><![CDATA[<p>Ja, du musst für jede unterschiedliche Art von Fenster eine andere WndProc verwenden. <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/613369</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/613369</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Thu, 23 Sep 2004 07:45:25 GMT</pubDate></item></channel></rss>