<?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[Daten eingabe in einem Fenster]]></title><description><![CDATA[<p>Hi, ich wollte ein Chat programmieren aber irgendwie kriege ich keine 2 konsolenfenster hin und steige nun auf grafisch um was ich eh über kurz oder lang vorhatte.</p>
<p>Da Ich das noch nie gemacht habe bitte ich um hilfe.</p>
<p>Erstmal will ich etwas hinbekommen was text einliest ein Consolen fenster öffnet und dort irgendetwas wieder ausgibt.</p>
<pre><code class="language-cpp">// Chat fenster.cpp : Definiert den Einstiegspunkt für die Anwendung.
//

#include &quot;stdafx.h&quot;
#include &quot;Chat fenster.h&quot;
#include &lt;WinUser.h&gt;
#include &lt;iostream&gt;
#include &lt;windows.h&gt;

using namespace std;

int main()
{
	HANDLE Buffer;
	AllocConsole(); 
	Sleep(1000);
	Buffer=CreateConsoleScreenBuffer(GENERIC_WRITE,0x00000002,NULL,CONSOLE_TEXTMODE_BUFFER,NULL);

	WriteConsole(Buffer,&quot;HAlLO&quot;,NULL,NULL,NULL);
	cout&lt;&lt;&quot;test&quot;;
}

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

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

	const char szAppName[] = &quot;Texte einlesen&quot;;
	const char szTitelName[] = &quot;Test&quot;;
	TCHAR Titel[5];
	LoadString(hInstance,NULL,(LPWSTR)szTitelName,5);

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

	RegisterClass(&amp;wc);

	hWnd = CreateWindowExW(  
		WS_EX_APPWINDOW,
		(LPCWSTR)szAppName,
		Titel,
		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 RECT     rect;
	static char     cBuffer[100];
	static int      iActLen;

	switch (message)
	{
	case WM_SIZE:
		{
			rect.left   = 20;
			rect.right  = LOWORD(lParam) - 20;
			rect.bottom = HIWORD(lParam);
			return 0;
		}
	case WM_CHAR:
		{
			switch (wParam)
			{
			case '\r':
				iActLen = 0;
				InvalidateRect(hWnd, NULL, TRUE);
				break;

			case '\b':
				if (iActLen &lt;= 0)
					break;

				iActLen--;
				InvalidateRect(hWnd, NULL, TRUE);
				break;

			case '\t':
			case '\n':
			case  27 :
				break;
			default:
				if (iActLen &lt; sizeof(cBuffer))
				{
					cBuffer[iActLen++] = wParam;
					InvalidateRect(hWnd, NULL, FALSE);
				}
				break;
			}
			return 0;
		}
	case WM_PAINT:
		{
			PAINTSTRUCT  ps;
			HDC          hDC;

			hDC = BeginPaint(hWnd, &amp;ps);
			{
				DrawTextW(hDC, (LPCWSTR)cBuffer, iActLen, &amp;rect, 
					DT_SINGLELINE | DT_VCENTER);
			}
			EndPaint(hWnd, &amp;ps);
			return 0;
		}
	case WM_KEYDOWN:
		{
			if (wParam == VK_ESCAPE)
			{
				SendMessage(hWnd, WM_CLOSE, 0, 0);
			}
			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/209924/daten-eingabe-in-einem-fenster</link><generator>RSS for Node</generator><lastBuildDate>Wed, 22 Apr 2026 04:53:28 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/209924.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 04 Apr 2008 19:00:39 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Daten eingabe in einem Fenster on Fri, 04 Apr 2008 19:25:42 GMT]]></title><description><![CDATA[<p>Hi, ich wollte ein Chat programmieren aber irgendwie kriege ich keine 2 konsolenfenster hin und steige nun auf grafisch um was ich eh über kurz oder lang vorhatte.</p>
<p>Da Ich das noch nie gemacht habe bitte ich um hilfe.</p>
<p>Erstmal will ich etwas hinbekommen was text einliest ein Consolen fenster öffnet und dort irgendetwas wieder ausgibt.</p>
<pre><code class="language-cpp">// Chat fenster.cpp : Definiert den Einstiegspunkt für die Anwendung.
//

#include &quot;stdafx.h&quot;
#include &quot;Chat fenster.h&quot;
#include &lt;WinUser.h&gt;
#include &lt;iostream&gt;
#include &lt;windows.h&gt;

using namespace std;

int main()
{
	HANDLE Buffer;
	AllocConsole(); 
	Sleep(1000);
	Buffer=CreateConsoleScreenBuffer(GENERIC_WRITE,0x00000002,NULL,CONSOLE_TEXTMODE_BUFFER,NULL);

	WriteConsole(Buffer,&quot;HAlLO&quot;,NULL,NULL,NULL);
	cout&lt;&lt;&quot;test&quot;;
}

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

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

	const char szAppName[] = &quot;Texte einlesen&quot;;
	const char szTitelName[] = &quot;Test&quot;;
	TCHAR Titel[5];
	LoadString(hInstance,NULL,(LPWSTR)szTitelName,5);

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

	RegisterClass(&amp;wc);

	hWnd = CreateWindowExW(  
		WS_EX_APPWINDOW,
		(LPCWSTR)szAppName,
		Titel,
		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 RECT     rect;
	static char     cBuffer[100];
	static int      iActLen;

	switch (message)
	{
	case WM_SIZE:
		{
			rect.left   = 20;
			rect.right  = LOWORD(lParam) - 20;
			rect.bottom = HIWORD(lParam);
			return 0;
		}
	case WM_CHAR:
		{
			switch (wParam)
			{
			case '\r':
				iActLen = 0;
				InvalidateRect(hWnd, NULL, TRUE);
				break;

			case '\b':
				if (iActLen &lt;= 0)
					break;

				iActLen--;
				InvalidateRect(hWnd, NULL, TRUE);
				break;

			case '\t':
			case '\n':
			case  27 :
				break;
			default:
				if (iActLen &lt; sizeof(cBuffer))
				{
					cBuffer[iActLen++] = wParam;
					InvalidateRect(hWnd, NULL, FALSE);
				}
				break;
			}
			return 0;
		}
	case WM_PAINT:
		{
			PAINTSTRUCT  ps;
			HDC          hDC;

			hDC = BeginPaint(hWnd, &amp;ps);
			{
				DrawTextW(hDC, (LPCWSTR)cBuffer, iActLen, &amp;rect, 
					DT_SINGLELINE | DT_VCENTER);
			}
			EndPaint(hWnd, &amp;ps);
			return 0;
		}
	case WM_KEYDOWN:
		{
			if (wParam == VK_ESCAPE)
			{
				SendMessage(hWnd, WM_CLOSE, 0, 0);
			}
			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/1486689</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1486689</guid><dc:creator><![CDATA[Matyr]]></dc:creator><pubDate>Fri, 04 Apr 2008 19:25:42 GMT</pubDate></item><item><title><![CDATA[Reply to Daten eingabe in einem Fenster on Fri, 04 Apr 2008 19:48:43 GMT]]></title><description><![CDATA[<p>versuch halt einfach ma mit ner mdi vll klappts</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1486708</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1486708</guid><dc:creator><![CDATA[pat94]]></dc:creator><pubDate>Fri, 04 Apr 2008 19:48:43 GMT</pubDate></item><item><title><![CDATA[Reply to Daten eingabe in einem Fenster on Fri, 04 Apr 2008 19:56:21 GMT]]></title><description><![CDATA[<p>was ist eine mdi? <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="😕"
    /></p>
<p>Ich habe gerade erst angefangen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1486712</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1486712</guid><dc:creator><![CDATA[Matyr]]></dc:creator><pubDate>Fri, 04 Apr 2008 19:56:21 GMT</pubDate></item><item><title><![CDATA[Reply to Daten eingabe in einem Fenster on Fri, 04 Apr 2008 20:17:14 GMT]]></title><description><![CDATA[<p>Matyr schrieb:</p>
<blockquote>
<p>Erstmal will ich etwas hinbekommen was text einliest ein Consolen fenster öffnet und dort irgendetwas wieder ausgibt.</p>
</blockquote>
<p>Und deine Frage lautet?</p>
<p>Matyr schrieb:</p>
<blockquote>
<p>pat94 schrieb:</p>
<blockquote>
<p>versuch halt einfach ma mit ner mdi vll klappts</p>
</blockquote>
<p>was ist eine mdi? <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="😕"
    /></p>
</blockquote>
<p><a href="http://en.wikipedia.org/wiki/Multiple_Document_Interface" rel="nofollow">Multiple Document Interface</a></p>
<p>Matyr schrieb:</p>
<blockquote>
<p>Ich habe gerade erst angefangen</p>
</blockquote>
<p>Dann würd' ich von Netzwerkprogrammierung und der WinAPI erstmal die Finger lassen, bis du in C halbwegs sattelfest bist.</p>
<p>Matyr schrieb:</p>
<blockquote>
<pre><code class="language-cpp">int main()
</code></pre>
</blockquote>
<p><strong>und</strong></p>
<p>Matyr schrieb:</p>
<blockquote>
<pre><code class="language-cpp">int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
                   PSTR szCmdLine, int iCmdShow)
</code></pre>
</blockquote>
<p>kann's schonmal nicht sein.</p>
<p>cheers, Swordfish</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1486719</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1486719</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Fri, 04 Apr 2008 20:17:14 GMT</pubDate></item><item><title><![CDATA[Reply to Daten eingabe in einem Fenster on Fri, 04 Apr 2008 20:28:28 GMT]]></title><description><![CDATA[<p>Nicht mit C angefangen sondern mit WINAPI und wieso kann das nicht sein und frage ist wo die fehler liegen,</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1486724</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1486724</guid><dc:creator><![CDATA[Matyr]]></dc:creator><pubDate>Fri, 04 Apr 2008 20:28:28 GMT</pubDate></item><item><title><![CDATA[Reply to Daten eingabe in einem Fenster on Fri, 04 Apr 2008 20:45:02 GMT]]></title><description><![CDATA[<p>Swordfish schrieb:</p>
<blockquote>
<p>Matyr schrieb:</p>
<blockquote>
<pre><code class="language-cpp">int main()
</code></pre>
</blockquote>
<p><strong>und</strong></p>
<p>Matyr schrieb:</p>
<blockquote>
<pre><code class="language-cpp">int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
                   PSTR szCmdLine, int iCmdShow)
</code></pre>
</blockquote>
<p>kann's schonmal nicht sein.</p>
<p>cheers, Swordfish</p>
</blockquote>
<p>Hmm ich hab es jetzt selber nicht ausprobiert ob der Compiler/Linker hier nen Fehler bringt, dennoch die Funktion <em>int main()</em> ist der Einstiegspunkt für eine Konsolenanwendung, die Funktion <em>int WINAPI WinMain (...)</em> ist der Einstiegspunkt für eine GUI-Anwendung. Auch wenn es geht, solltest du keine (normale) Funktion <em>main</em> oder <em>WinMain</em> nennen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1486730</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1486730</guid><dc:creator><![CDATA[yogle_]]></dc:creator><pubDate>Fri, 04 Apr 2008 20:45:02 GMT</pubDate></item><item><title><![CDATA[Reply to Daten eingabe in einem Fenster on Fri, 04 Apr 2008 20:48:12 GMT]]></title><description><![CDATA[<p>Aber um vielleicht mal auf dein Problem einzugehen, versuch mal das hier:</p>
<pre><code class="language-cpp">int hCrt = 0;
FILE *hfOutput = NULL;

AllocConsole();

// Set output handle to allocated console
hCrt = _open_osfhandle (reinterpret_cast&lt;intptr_t&gt; (GetStdHandle (STD_OUTPUT_HANDLE)), _O_TEXT);
hfOutput = _fdopen (hCrt, &quot;w&quot;);

*stdout = *hfOutput;
setvbuf (stdout, NULL, _IONBF, 0);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1486731</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1486731</guid><dc:creator><![CDATA[yogle_]]></dc:creator><pubDate>Fri, 04 Apr 2008 20:48:12 GMT</pubDate></item><item><title><![CDATA[Reply to Daten eingabe in einem Fenster on Fri, 04 Apr 2008 20:49:04 GMT]]></title><description><![CDATA[<p>ok</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1486732</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1486732</guid><dc:creator><![CDATA[Matyr]]></dc:creator><pubDate>Fri, 04 Apr 2008 20:49:04 GMT</pubDate></item></channel></rss>