<?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[Kopierzähler: hInstance = ( ( LPCREATESTRUCT ) lParam ) -&amp;gt; hInstance !!! versteh ich nicht ganz!??!]]></title><description><![CDATA[<p>hallo, ich experimentiere gerade etwas mit Buttons, SB, EB, RB ... usw. rum. und jedenfalls bin ich nun auf</p>
<pre><code>hInstance = ( ( LPCREATESTRUCT ) lParam ) -&gt; hInstance
</code></pre>
<p>gestoßen, was mir aber net ganz einleuchtet. könnte mir hier an dieser stelle vllt. jemand mal etwas nachhilfe geben? wie genau des mit dem Kopierzähle geht.</p>
<p>Danke, Gruß Tobi!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/172966/kopierzähler-hinstance-lpcreatestruct-lparam-gt-hinstance-versteh-ich-nicht-ganz</link><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Jul 2026 05:49:43 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/172966.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 10 Feb 2007 11:22:06 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Kopierzähler: hInstance = ( ( LPCREATESTRUCT ) lParam ) -&amp;gt; hInstance !!! versteh ich nicht ganz!??! on Sat, 10 Feb 2007 11:22:06 GMT]]></title><description><![CDATA[<p>hallo, ich experimentiere gerade etwas mit Buttons, SB, EB, RB ... usw. rum. und jedenfalls bin ich nun auf</p>
<pre><code>hInstance = ( ( LPCREATESTRUCT ) lParam ) -&gt; hInstance
</code></pre>
<p>gestoßen, was mir aber net ganz einleuchtet. könnte mir hier an dieser stelle vllt. jemand mal etwas nachhilfe geben? wie genau des mit dem Kopierzähle geht.</p>
<p>Danke, Gruß Tobi!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1226109</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1226109</guid><dc:creator><![CDATA[T0bi]]></dc:creator><pubDate>Sat, 10 Feb 2007 11:22:06 GMT</pubDate></item><item><title><![CDATA[Reply to Kopierzähler: hInstance = ( ( LPCREATESTRUCT ) lParam ) -&amp;gt; hInstance !!! versteh ich nicht ganz!??! on Sat, 10 Feb 2007 13:47:39 GMT]]></title><description><![CDATA[<p>Jedes gestartete Programm bekommt vom Betriebssystem (Windows) ein Instanz-Handle. Wenn Du nun (Child-)Fenster erzeugen willst, brauchst Du dieses Instanzhandle für den Aufruf von CreateWindow(Ex)(...).</p>
<p>Bei der Botschaft WM_CREATE wird per lParam ein Zeiger auf CREATESTRUCT mitgeliefert.</p>
<pre><code class="language-cpp">int _stdcall WndProc(HWND hwnd, unsigned int message, unsigned int wParam, long lParam)
{
  HINSTANCE hInstance;

  switch(message)
    { case WM_CREATE:
          hInstance = ((LPCREATESTRUCT)lParam)-&gt;hInstance;
        oder
          hInstance = GetWindowLong(hwnd, GWL_HINSTANCE);
          CreateWindow(&quot;button&quot;, ... hInstance, 0);
          return 0;
    }
  return DefWindowProc(hwnd, message, wParam, lParam);
}
</code></pre>
<p><strong>oder</strong></p>
<pre><code class="language-cpp">HINSTANCE hInstGlobal;

... WinMain(HINSTANCE hInstance, ...)
{
  hInstGlobal = hInstance;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1226193</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1226193</guid><dc:creator><![CDATA[keksekekse]]></dc:creator><pubDate>Sat, 10 Feb 2007 13:47:39 GMT</pubDate></item><item><title><![CDATA[Reply to Kopierzähler: hInstance = ( ( LPCREATESTRUCT ) lParam ) -&amp;gt; hInstance !!! versteh ich nicht ganz!??! on Sat, 10 Feb 2007 15:02:58 GMT]]></title><description><![CDATA[<p>zuwas würde e3s führen, wenn ich diese deklaration von hInstance einfach wg lassen wuerde?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1226253</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1226253</guid><dc:creator><![CDATA[T0bi]]></dc:creator><pubDate>Sat, 10 Feb 2007 15:02:58 GMT</pubDate></item><item><title><![CDATA[Reply to Kopierzähler: hInstance = ( ( LPCREATESTRUCT ) lParam ) -&amp;gt; hInstance !!! versteh ich nicht ganz!??! on Sat, 10 Feb 2007 15:39:01 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">CreateWindow(..., 0, 0);
</code></pre>
<p>funktioniert auch.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1226276</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1226276</guid><dc:creator><![CDATA[keksekekse]]></dc:creator><pubDate>Sat, 10 Feb 2007 15:39:01 GMT</pubDate></item><item><title><![CDATA[Reply to Kopierzähler: hInstance = ( ( LPCREATESTRUCT ) lParam ) -&amp;gt; hInstance !!! versteh ich nicht ganz!??! on Sat, 10 Feb 2007 15:57:17 GMT]]></title><description><![CDATA[<p>hmm also is es ueberflüssig? auch bei mehreren Windows? also ein parent mit 20button... da braeuchte man es au net?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1226283</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1226283</guid><dc:creator><![CDATA[T0bi]]></dc:creator><pubDate>Sat, 10 Feb 2007 15:57:17 GMT</pubDate></item><item><title><![CDATA[Reply to Kopierzähler: hInstance = ( ( LPCREATESTRUCT ) lParam ) -&amp;gt; hInstance !!! versteh ich nicht ganz!??! on Sat, 10 Feb 2007 17:49:22 GMT]]></title><description><![CDATA[<p>Also wenn Du das:</p>
<p>T0bi schrieb:</p>
<blockquote>
<p>zuwas würde e3s führen, wenn ich diese deklaration von hInstance einfach wg lassen wuerde?</p>
</blockquote>
<p>auf das:</p>
<p>keksekekse schrieb:</p>
<blockquote>
<pre><code class="language-cpp">HINSTANCE hInstGlobal;

... WinMain(HINSTANCE hInstance, ...)
{
  hInstGlobal = hInstance;
}
</code></pre>
</blockquote>
<p>beziehst...dann geht es nicht, da die Syntax der Funktion WinMain vorgeschrieben ist.</p>
<p>keksekekse schrieb:</p>
<blockquote>
<pre><code class="language-cpp">CreateWindow(..., 0, 0);
</code></pre>
<p>funktioniert auch.</p>
</blockquote>
<p>Da der Instanz-Handle der aktuellen Instanz angenommen wird.</p>
<p>T0bi schrieb:</p>
<blockquote>
<p>hmm also is es ueberflüssig? auch bei mehreren Windows? also ein parent mit 20button... da braeuchte man es au net?</p>
</blockquote>
<p>Ja, in diesem Fall schon, da es ja bei allen Fenstern um die gleiche Instanz handelt. Wenn Du zum Beispiel ein Control in einer anderen Anwendung erstellen willst, musst Du dann im HINSTANCE-Parameter den entsprechenden Handle angeben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1226377</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1226377</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Sat, 10 Feb 2007 17:49:22 GMT</pubDate></item></channel></rss>