<?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[Megadringend Hilfe mit Variablenausgabe]]></title><description><![CDATA[<p>hi... kann mir jemand sagen, wie ich eine variable in winapi ausgebe:</p>
<pre><code>[cpp]for (;x&lt;=500,y&lt;=500;x=x+20,y=y+20,a++)
			TextOut (dc,x,y,a,1);
		ReleaseDC(hwnd,dc);
		return 0;[/cpp]
</code></pre>
<p>... möchte variable a ausgeben und leider keine ahnung wie das geht.</p>
<p>-sry, bin neu in winapi-</p>
<p>thx</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/143216/megadringend-hilfe-mit-variablenausgabe</link><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Jul 2026 00:30:33 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/143216.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 06 Apr 2006 11:02:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Megadringend Hilfe mit Variablenausgabe on Thu, 06 Apr 2006 11:02:52 GMT]]></title><description><![CDATA[<p>hi... kann mir jemand sagen, wie ich eine variable in winapi ausgebe:</p>
<pre><code>[cpp]for (;x&lt;=500,y&lt;=500;x=x+20,y=y+20,a++)
			TextOut (dc,x,y,a,1);
		ReleaseDC(hwnd,dc);
		return 0;[/cpp]
</code></pre>
<p>... möchte variable a ausgeben und leider keine ahnung wie das geht.</p>
<p>-sry, bin neu in winapi-</p>
<p>thx</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1031815</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1031815</guid><dc:creator><![CDATA[MW_ICEMAN]]></dc:creator><pubDate>Thu, 06 Apr 2006 11:02:52 GMT</pubDate></item><item><title><![CDATA[Reply to Megadringend Hilfe mit Variablenausgabe on Thu, 06 Apr 2006 11:16:44 GMT]]></title><description><![CDATA[<p>Mittels sprintf bzw. _stprintf in einen String umwandeln und dann den String ausgeben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1031827</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1031827</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Thu, 06 Apr 2006 11:16:44 GMT</pubDate></item><item><title><![CDATA[Reply to Megadringend Hilfe mit Variablenausgabe on Thu, 06 Apr 2006 11:17:49 GMT]]></title><description><![CDATA[<p>wie jetzt?!.. jetzt genauer.. Bitte!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1031829</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1031829</guid><dc:creator><![CDATA[MW_ICEMAN]]></dc:creator><pubDate>Thu, 06 Apr 2006 11:17:49 GMT</pubDate></item><item><title><![CDATA[Reply to Megadringend Hilfe mit Variablenausgabe on Thu, 06 Apr 2006 11:20:04 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">TCHAR szBuffer[100];
  int iWert = 12;
  _stprintf(szBuffer, _T(&quot;%d&quot;), iWert);
  TextOut(hDc, 0, 0, szBuffer, _tcslen(szBuffer));
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1031831</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1031831</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Thu, 06 Apr 2006 11:20:04 GMT</pubDate></item><item><title><![CDATA[Reply to Megadringend Hilfe mit Variablenausgabe on Thu, 06 Apr 2006 11:25:40 GMT]]></title><description><![CDATA[<p>sry seh leider jetzt gar nich mehr durch...</p>
<p>hier mal das komplette prog..</p>
<p>[code]</p>
<pre><code class="language-cpp">//aufgabe3.cpp (by) Matthias Walter

#include &lt;windows.h&gt;
#include &lt;string&gt;
using namespace std;

HDC dc;
MSG n;
static int x, y;

//static char a='A';

LRESULT CALLBACK Fensterfunktion(HWND hwnd,UINT message,
								 WPARAM wparam, LPARAM lparam) {
	switch(message) {

	case WM_LBUTTONDOWN:
		x=LOWORD(lparam);
		y=HIWORD(lparam);
		dc=GetDC (hwnd);
		if (dc != NULL)

			for (;x&lt;=500,y&lt;=500;x=x+20,y=y+20,a++)
				TCHAR szBuffer[100]; 

			_stprintf(szBuffer, _T(&quot;%d&quot;), a); 
			TextOut(hDc, x, y, szBuffer, _tcslen(szBuffer));

			//TextOut (dc,x,y,a,1);

		ReleaseDC(hwnd,dc);
		return 0;

	case WM_DESTROY:
		PostQuitMessage(0);
		return 0;

	}	
	return DefWindowProc(hwnd, message, wparam, lparam);
}
HDC GEtDC(HWND hwnd);
int Release(HWND hwnd, HDC dc);

int WINAPI WinMain(HINSTANCE dieseInstanz,HINSTANCE
				   vorigeInstanz,LPSTR t, int d) {

	HWND f;
	char szAppName[]=&quot;Eine neue Fensterklasse&quot;;
	WNDCLASS wc;
	wc.style		= CS_HREDRAW | CS_VREDRAW ;
	wc.lpfnWndProc	= Fensterfunktion;
	wc.cbClsExtra	= 0;
	wc.cbWndExtra	= 0;
	wc.hInstance	= dieseInstanz;
	wc.hIcon		= LoadIcon(NULL, IDI_HAND);
	wc.hCursor		= LoadCursor(NULL, IDC_ARROW);
	wc.hbrBackground= CreateSolidBrush(RGB(255,255,255));
	wc.lpszMenuName	= NULL;
	wc.lpszClassName= szAppName;

	if (!RegisterClass(&amp;wc))	{		

		return 0;
	};

	f = CreateWindow ( szAppName,
			&quot;Wir experimentieren&quot;,
			WS_OVERLAPPEDWINDOW |  WS_VISIBLE,
			100,
			150,
			600,
			500,
			NULL,
			NULL,
			dieseInstanz,
			NULL);
	while (GetMessage(&amp;n,NULL,0,0) ) {
		DispatchMessage(&amp;n);
	};
	return n.wParam;

}[/
</code></pre>
<p>code]</p>
<p>naja... es soll halt eine ascii zeichenkette ausgegeben werden diie mit a beginnt....</p>
<p>also müsst ich jetzt dein iwert als character nehmen oder wie?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1031839</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1031839</guid><dc:creator><![CDATA[MW_ICEMAN]]></dc:creator><pubDate>Thu, 06 Apr 2006 11:25:40 GMT</pubDate></item><item><title><![CDATA[Reply to Megadringend Hilfe mit Variablenausgabe on Thu, 06 Apr 2006 11:39:16 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">//aufgabe3.cpp (by) Matthias Walter

#include &lt;windows.h&gt;
#include &lt;string&gt;
using namespace std;

HDC dc;
MSG n;
static int x, y;

//static char a='A';

LRESULT CALLBACK Fensterfunktion(HWND hwnd,UINT message,
                                 WPARAM wparam, LPARAM lparam) {
    switch(message) {

    case WM_LBUTTONDOWN:
        x=LOWORD(lparam);
        y=HIWORD(lparam);
        dc=GetDC (hwnd);
        if (dc != NULL) 
        {               // &lt;- neuer Code-Block
            TCHAR szBuffer[100]; // vor der iteration
            for (;x&lt;=500,y&lt;=500;x=x+20,y=y+20,a++)
            {
                _stprintf(szBuffer, _T(&quot;%d&quot;), a);
                TextOut(hDc, x, y, szBuffer, _tcslen(szBuffer));
            } // end for
        } // end if

            //TextOut (dc,x,y,a,1);

        ReleaseDC(hwnd,dc);
        return 0;

    case WM_DESTROY:
        PostQuitMessage(0);
        return 0;

    }   
    return DefWindowProc(hwnd, message, wparam, lparam);
}
HDC GEtDC(HWND hwnd);
int Release(HWND hwnd, HDC dc);

int WINAPI WinMain(HINSTANCE dieseInstanz,HINSTANCE
                   vorigeInstanz,LPSTR t, int d) {

    HWND f;
    char szAppName[]=&quot;Eine neue Fensterklasse&quot;;
    WNDCLASS wc;
    wc.style        = CS_HREDRAW | CS_VREDRAW ;
    wc.lpfnWndProc    = Fensterfunktion;
    wc.cbClsExtra    = 0;
    wc.cbWndExtra    = 0;
    wc.hInstance    = dieseInstanz;
    wc.hIcon        = LoadIcon(NULL, IDI_HAND);
    wc.hCursor        = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground= CreateSolidBrush(RGB(255,255,255));
    wc.lpszMenuName    = NULL;
    wc.lpszClassName= szAppName;

    if (!RegisterClass(&amp;wc))    {       

        return 0;
    };

    f = CreateWindow ( szAppName,
            &quot;Wir experimentieren&quot;,
            WS_OVERLAPPEDWINDOW |  WS_VISIBLE,
            100,
            150,
            600,
            500,
            NULL,
            NULL,
            dieseInstanz,
            NULL);
    while (GetMessage(&amp;n,NULL,0,0) ) {
        DispatchMessage(&amp;n);
    };
    return n.wParam;

}
</code></pre>
<p>Du hast immer wieder TCHAR szBuffer[100] in der for-Schleife angelegt, und dann einmal den Wert von a in den String kopiert.<br />
Schau dir den Code oben mal an.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1031863</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1031863</guid><dc:creator><![CDATA[qasdfgh]]></dc:creator><pubDate>Thu, 06 Apr 2006 11:39:16 GMT</pubDate></item></channel></rss>