<?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[CreateDIBSection - zeichnen schlägt fehl]]></title><description><![CDATA[<p>hallo,</p>
<p>ich habe ein fenster hWnd mit 400 * 400 pixeln.</p>
<p>dann habe ich eine HBITMAP erzeugt durch eben diese funktion CreateDIBSection.<br />
das handle ist gültig und der bit-zeiger auch. ich kann auch super darauf<br />
byte für byte rummalen. nur normale funktionen wie TextOut gehen nicht mehr</p>
<p>msdn meint dazu ich soll GdiFlush aufrufen, aber egal wieoft ich das tue,<br />
es kommt trotzdem kein text</p>
<pre><code class="language-cpp">void render(GdiDraw *gdi)
{
	GdiFlush();
	struct rgb
	{
		unsigned char r, g, b, a;
	};
	rgb *ptr = (rgb *)GetBits(gdi);
	for (unsigned i = 0; i &lt; GetHeight(gdi); ++i)
	{
		for (unsigned j = 0; j &lt; GetWidth(gdi); ++j)
		{
			rgb *curr = ptr + i * GetWidth(gdi) + j;
			curr-&gt;r = rand() % 256;
			curr-&gt;g = rand() % 256;
			curr-&gt;b = rand() % 256;
		}
	}
	GdiFlush();
	TextOut(GetDeviceContext(gdi), 50, 50, &quot;huhu&quot;, 4);
	GdiFlush();
}
</code></pre>
<p>GdiDraw ist eine struktur die alles wichtige enthällt.</p>
<p>der HDC den ich für die TextOut-funktion brauche, ist ein gültiger dc von<br />
GetDC.</p>
<p>das bild wird auch schön bunt durch die schleife, nur kommt kein text</p>
<p>MfG devicecontext</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/231126/createdibsection-zeichnen-schlägt-fehl</link><generator>RSS for Node</generator><lastBuildDate>Thu, 09 Apr 2026 18:47:39 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/231126.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 06 Jan 2009 23:18:07 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CreateDIBSection - zeichnen schlägt fehl on Tue, 06 Jan 2009 23:18:07 GMT]]></title><description><![CDATA[<p>hallo,</p>
<p>ich habe ein fenster hWnd mit 400 * 400 pixeln.</p>
<p>dann habe ich eine HBITMAP erzeugt durch eben diese funktion CreateDIBSection.<br />
das handle ist gültig und der bit-zeiger auch. ich kann auch super darauf<br />
byte für byte rummalen. nur normale funktionen wie TextOut gehen nicht mehr</p>
<p>msdn meint dazu ich soll GdiFlush aufrufen, aber egal wieoft ich das tue,<br />
es kommt trotzdem kein text</p>
<pre><code class="language-cpp">void render(GdiDraw *gdi)
{
	GdiFlush();
	struct rgb
	{
		unsigned char r, g, b, a;
	};
	rgb *ptr = (rgb *)GetBits(gdi);
	for (unsigned i = 0; i &lt; GetHeight(gdi); ++i)
	{
		for (unsigned j = 0; j &lt; GetWidth(gdi); ++j)
		{
			rgb *curr = ptr + i * GetWidth(gdi) + j;
			curr-&gt;r = rand() % 256;
			curr-&gt;g = rand() % 256;
			curr-&gt;b = rand() % 256;
		}
	}
	GdiFlush();
	TextOut(GetDeviceContext(gdi), 50, 50, &quot;huhu&quot;, 4);
	GdiFlush();
}
</code></pre>
<p>GdiDraw ist eine struktur die alles wichtige enthällt.</p>
<p>der HDC den ich für die TextOut-funktion brauche, ist ein gültiger dc von<br />
GetDC.</p>
<p>das bild wird auch schön bunt durch die schleife, nur kommt kein text</p>
<p>MfG devicecontext</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1640742</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1640742</guid><dc:creator><![CDATA[devicecontext]]></dc:creator><pubDate>Tue, 06 Jan 2009 23:18:07 GMT</pubDate></item><item><title><![CDATA[Reply to CreateDIBSection - zeichnen schlägt fehl on Tue, 06 Jan 2009 23:45:10 GMT]]></title><description><![CDATA[<p>falscher device context</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1640756</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1640756</guid><dc:creator><![CDATA[KommisarIsDochKlar]]></dc:creator><pubDate>Tue, 06 Jan 2009 23:45:10 GMT</pubDate></item><item><title><![CDATA[Reply to CreateDIBSection - zeichnen schlägt fehl on Wed, 07 Jan 2009 11:29:43 GMT]]></title><description><![CDATA[<p>der devicekontext ist derselbe wo auch die bitmap von CreateDIBSection<br />
reinselektiert ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1641001</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1641001</guid><dc:creator><![CDATA[devicecontext]]></dc:creator><pubDate>Wed, 07 Jan 2009 11:29:43 GMT</pubDate></item></channel></rss>