<?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[Text im Fenster ausgeben]]></title><description><![CDATA[<p>Ich hab ein kleines Problem...Ich hab zum Geburtstag das Buch Spieleprogrammieren mit C++ und Genesis3D bekommen...In diesem Buch hab ich das erste mal was mit WinAPI gemacht...leider wird nur erklärt wie man mit Genesis3D 3D-Spiele macht...Nun habe ich mir den einfachen Quellcode für ein Windows-Fenster genommen und wollte in diesem ein Ratespiel zum laufenbringen (So wie in der Konsole)...Ich hab daher erstemal versucht nur einen einfachen Text auszugeben...Nun habe ich an mehreren Stellen des Codes versucht mit <em>std::cout&lt;&lt;&quot;Hallo&quot;;</em> den Text <strong>Hallo</strong> auszugeben (<em>iostream</em> hab ich includet)...So weit hat mein Compiler auch beim erstellen der EXE keinen Fehler gefunden...Nur jetzt kommt mein Problem: egal wo ich <em>std::cout&lt;&lt;&quot;Hallo&quot;;</em> im Code hin getan habe wurde am Ende kein <strong>Hallo</strong> im Fenster angezeicht...könnt ihr mir da helfen??? Geht das garnicht mit <em>std::cout&lt;&lt;&quot;Hallo&quot;;</em>???</p>
<p>Hier der Quellcode (ohne <em>std::cout&lt;&lt;&quot;Hallo&quot;;</em> und <em>#include &lt;iostream&gt;</em>:</p>
<pre><code class="language-cpp">//----------------------------------------------------------
// RatDochMal.cpp:
//----------------------------------------------------------

#include &quot;RatDochMal.h&quot;

LRESULT CALLBACK WndProc (HWND hWnd, 
  UINT iMessage, WPARAM wParam, LPARAM lParam);

int WINAPI WinMain
  (HINSTANCE hInstance, HINSTANCE hPrevInstance, 
   LPSTR lpCmdLine, int nShowCmd)
{
//----------------------------------------------------------
//Fensterklasse
//----------------------------------------------------------
  WNDCLASS Win;     
  MSG      msg; 
//----------------------------------------------------------
//Einstellungen
//----------------------------------------------------------
  Win.cbClsExtra = 0;
  Win.cbWndExtra = 0;
  Win.hInstance  = hInstance;    
  Win.hIcon = LoadIcon(hInstance, IDI_APPLICATION);
  Win.hCursor = LoadCursor(NULL, IDC_ARROW);
  Win.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
  Win.style = CS_HREDRAW | CS_VREDRAW;
  Win.lpfnWndProc = WndProc;
  Win.lpszClassName = &quot;???&quot;;
  Win.lpszMenuName = NULL;
  RegisterClass (&amp;Win);
//----------------------------------------------------------
//Fenster erstellen
//----------------------------------------------------------
  GHandle = CreateWindow (Win.lpszClassName, 
						  &quot;RatDochMal - [Esc]=Ende&quot;, 
						  WS_TILED, 
                          CW_USEDEFAULT, 
						  CW_USEDEFAULT, 
						  MaxWidth, 
                          MaxHeight, 
						  NULL, 
						  NULL, 
						  hInstance, 
						  NULL);
  if (!GHandle)
  {
    return 0;
  }
  ShowWindow   (GHandle, nShowCmd);
  UpdateWindow (GHandle);
//----------------------------------------------------------
//Programm
//---------------------------------------------------------- 
  isRunning = true;
  while (isRunning) 
  {
    while 
      (PeekMessage (&amp;msg, NULL, 0, 0, PM_NOREMOVE))
    {
      if (!GetMessage(&amp;msg, NULL, 0, 0 ))
      {
        isRunning = false;
        break;
      }
      TranslateMessage (&amp;msg);
      DispatchMessage  (&amp;msg);
    }
  }
  return 1;
}

//----------------------------------------------------------
//Fensterschliesen wenn Esc gedrückt
//----------------------------------------------------------
LRESULT CALLBACK WndProc (HWND hWnd, 
  UINT iMessage, WPARAM wParam, LPARAM lParam)
{
  switch (iMessage)
  {
    case WM_KEYDOWN:
    {
      switch (wParam)
      {
        case VK_ESCAPE:  
        {
          PostMessage(hWnd, WM_QUIT, 0, 0);
        }
      }
    }
    default:
      return DefWindowProc 
        (hWnd, iMessage, wParam, lParam);
  }
  return 0;
}
</code></pre>
<pre><code class="language-cpp">//-------------------------------------------------
//RatDochMal.h:
//-------------------------------------------------

#include &lt;windows.h&gt;

// Konstanten
const int MaxWidth     = 500;   // Max. Screenbreite
const int MaxHeight    = 300;   // Max. Screenhöhe

// Globalvariablen
HWND GHandle;                   // Fenster-Handle 
bool isRunning;                 // &quot;Laufvariable&quot;
</code></pre>
<p>Ich hoffe ihr könnt mir helfen</p>
<p>mfg Dimo</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/223974/text-im-fenster-ausgeben</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Apr 2026 21:33:36 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/223974.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 03 Oct 2008 15:13:45 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Text im Fenster ausgeben on Fri, 03 Oct 2008 15:13:45 GMT]]></title><description><![CDATA[<p>Ich hab ein kleines Problem...Ich hab zum Geburtstag das Buch Spieleprogrammieren mit C++ und Genesis3D bekommen...In diesem Buch hab ich das erste mal was mit WinAPI gemacht...leider wird nur erklärt wie man mit Genesis3D 3D-Spiele macht...Nun habe ich mir den einfachen Quellcode für ein Windows-Fenster genommen und wollte in diesem ein Ratespiel zum laufenbringen (So wie in der Konsole)...Ich hab daher erstemal versucht nur einen einfachen Text auszugeben...Nun habe ich an mehreren Stellen des Codes versucht mit <em>std::cout&lt;&lt;&quot;Hallo&quot;;</em> den Text <strong>Hallo</strong> auszugeben (<em>iostream</em> hab ich includet)...So weit hat mein Compiler auch beim erstellen der EXE keinen Fehler gefunden...Nur jetzt kommt mein Problem: egal wo ich <em>std::cout&lt;&lt;&quot;Hallo&quot;;</em> im Code hin getan habe wurde am Ende kein <strong>Hallo</strong> im Fenster angezeicht...könnt ihr mir da helfen??? Geht das garnicht mit <em>std::cout&lt;&lt;&quot;Hallo&quot;;</em>???</p>
<p>Hier der Quellcode (ohne <em>std::cout&lt;&lt;&quot;Hallo&quot;;</em> und <em>#include &lt;iostream&gt;</em>:</p>
<pre><code class="language-cpp">//----------------------------------------------------------
// RatDochMal.cpp:
//----------------------------------------------------------

#include &quot;RatDochMal.h&quot;

LRESULT CALLBACK WndProc (HWND hWnd, 
  UINT iMessage, WPARAM wParam, LPARAM lParam);

int WINAPI WinMain
  (HINSTANCE hInstance, HINSTANCE hPrevInstance, 
   LPSTR lpCmdLine, int nShowCmd)
{
//----------------------------------------------------------
//Fensterklasse
//----------------------------------------------------------
  WNDCLASS Win;     
  MSG      msg; 
//----------------------------------------------------------
//Einstellungen
//----------------------------------------------------------
  Win.cbClsExtra = 0;
  Win.cbWndExtra = 0;
  Win.hInstance  = hInstance;    
  Win.hIcon = LoadIcon(hInstance, IDI_APPLICATION);
  Win.hCursor = LoadCursor(NULL, IDC_ARROW);
  Win.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
  Win.style = CS_HREDRAW | CS_VREDRAW;
  Win.lpfnWndProc = WndProc;
  Win.lpszClassName = &quot;???&quot;;
  Win.lpszMenuName = NULL;
  RegisterClass (&amp;Win);
//----------------------------------------------------------
//Fenster erstellen
//----------------------------------------------------------
  GHandle = CreateWindow (Win.lpszClassName, 
						  &quot;RatDochMal - [Esc]=Ende&quot;, 
						  WS_TILED, 
                          CW_USEDEFAULT, 
						  CW_USEDEFAULT, 
						  MaxWidth, 
                          MaxHeight, 
						  NULL, 
						  NULL, 
						  hInstance, 
						  NULL);
  if (!GHandle)
  {
    return 0;
  }
  ShowWindow   (GHandle, nShowCmd);
  UpdateWindow (GHandle);
//----------------------------------------------------------
//Programm
//---------------------------------------------------------- 
  isRunning = true;
  while (isRunning) 
  {
    while 
      (PeekMessage (&amp;msg, NULL, 0, 0, PM_NOREMOVE))
    {
      if (!GetMessage(&amp;msg, NULL, 0, 0 ))
      {
        isRunning = false;
        break;
      }
      TranslateMessage (&amp;msg);
      DispatchMessage  (&amp;msg);
    }
  }
  return 1;
}

//----------------------------------------------------------
//Fensterschliesen wenn Esc gedrückt
//----------------------------------------------------------
LRESULT CALLBACK WndProc (HWND hWnd, 
  UINT iMessage, WPARAM wParam, LPARAM lParam)
{
  switch (iMessage)
  {
    case WM_KEYDOWN:
    {
      switch (wParam)
      {
        case VK_ESCAPE:  
        {
          PostMessage(hWnd, WM_QUIT, 0, 0);
        }
      }
    }
    default:
      return DefWindowProc 
        (hWnd, iMessage, wParam, lParam);
  }
  return 0;
}
</code></pre>
<pre><code class="language-cpp">//-------------------------------------------------
//RatDochMal.h:
//-------------------------------------------------

#include &lt;windows.h&gt;

// Konstanten
const int MaxWidth     = 500;   // Max. Screenbreite
const int MaxHeight    = 300;   // Max. Screenhöhe

// Globalvariablen
HWND GHandle;                   // Fenster-Handle 
bool isRunning;                 // &quot;Laufvariable&quot;
</code></pre>
<p>Ich hoffe ihr könnt mir helfen</p>
<p>mfg Dimo</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1593011</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1593011</guid><dc:creator><![CDATA[Dimo]]></dc:creator><pubDate>Fri, 03 Oct 2008 15:13:45 GMT</pubDate></item><item><title><![CDATA[Reply to Text im Fenster ausgeben on Fri, 03 Oct 2008 15:50:12 GMT]]></title><description><![CDATA[<p>Moin,</p>
<p>die Standard I/O Library funktioniert nur in Konsolenprogrammen, damit kommst Du in einer GUI nicht sehr weit ...</p>
<p><a href="http://www.winprog.org/tutorial/fonts.html" rel="nofollow">http://www.winprog.org/tutorial/fonts.html</a></p>
<p>Du brauchst ein &quot;Edit&quot;-Fenster/Steuerelement für die Eingabe von Text ...</p>
<p><a href="http://msdn.microsoft.com/en-us/library/bb773169%28VS.85%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/bb773169%28VS.85%29.aspx</a></p>
<p>Gruß<br />
Greenhorn</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1593034</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1593034</guid><dc:creator><![CDATA[C++Greenhorn 0]]></dc:creator><pubDate>Fri, 03 Oct 2008 15:50:12 GMT</pubDate></item><item><title><![CDATA[Reply to Text im Fenster ausgeben on Sat, 04 Oct 2008 07:42:26 GMT]]></title><description><![CDATA[<p>Jo danke...aber kannste mir des mal erklären??? bin net grad der beste in Englisch</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1593231</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1593231</guid><dc:creator><![CDATA[Dimo]]></dc:creator><pubDate>Sat, 04 Oct 2008 07:42:26 GMT</pubDate></item><item><title><![CDATA[Reply to Text im Fenster ausgeben on Sat, 04 Oct 2008 22:27:36 GMT]]></title><description><![CDATA[<p>Schau dir mal das hier an ...</p>
<p><a href="http://www.win-api.de/tutorials.php?tutid=18" rel="nofollow">http://www.win-api.de/tutorials.php?tutid=18</a></p>
<p>und ...</p>
<p><a href="http://www.henkessoft3000.de/" rel="nofollow">http://www.henkessoft3000.de/</a></p>
<p>Gruß<br />
Greenhorn</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1593511</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1593511</guid><dc:creator><![CDATA[C++Greenhorn 0]]></dc:creator><pubDate>Sat, 04 Oct 2008 22:27:36 GMT</pubDate></item><item><title><![CDATA[Reply to Text im Fenster ausgeben on Sun, 05 Oct 2008 11:20:21 GMT]]></title><description><![CDATA[<p>Jo danke werd mir das mal genauer anschauen und hoffen dann das bald alles läuft</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1593644</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1593644</guid><dc:creator><![CDATA[Dimo]]></dc:creator><pubDate>Sun, 05 Oct 2008 11:20:21 GMT</pubDate></item><item><title><![CDATA[Reply to Text im Fenster ausgeben on Mon, 06 Oct 2008 23:03:43 GMT]]></title><description><![CDATA[<p>Er kann sich mit AllocConsole und FreeConsole eine Konsole erzeugen und muss nur die Standard Ausgaben auf diese umleiten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1594529</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1594529</guid><dc:creator><![CDATA[Florian90]]></dc:creator><pubDate>Mon, 06 Oct 2008 23:03:43 GMT</pubDate></item></channel></rss>