<?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[Speicher problem bei Klasse]]></title><description><![CDATA[<p>Hi @ All.</p>
<p>in der Initialisierungsliste meiner Klasse wird hInstance mit GetModuleHandle(0) initialisiert.</p>
<p>Im konstruktor stimmt der Wert auch noch. (If (hInstance == GetModuleHandle(0)) == true).</p>
<p>Wenn ich aber in einer memberfunc nun diesen Vergleich anstelle, dann ist es = false.</p>
<p>woran kann das liegen?</p>
<pre><code class="language-cpp">// H

#define _WIN32_WINNT 0x0510
#include &lt;windows.h&gt;

#pragma once

class CSettingsWnd
{
public:
	CSettingsWnd(void);
	~CSettingsWnd(void);
	void Show(HWND hParent);

	INT_PTR CALLBACK DialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
	static INT_PTR CALLBACK StaticProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);

private:
	HINSTANCE hInstance;
};

// CPP

#define _WIN32_WINNT 0x0510
#include &lt;windows.h&gt;

#include &quot;SettingsWnd.h&quot;
#include &quot;script.h&quot;

CSettingsWnd::CSettingsWnd(void) : hInstance(GetModuleHandle(0))
{
}

CSettingsWnd::~CSettingsWnd(void)
{
}

void CSettingsWnd::Show(HWND hParent)
{
	// Hier stimmt hInstance nicht mehr mit GetModuleHandle(0) überein.
	DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_SETTINGS), hParent, StaticProc, (long)this);
}
</code></pre>
<p>Woran könnte dass den liegen??<br />
Wenn ich versuche, im Show-Member die hInstance = GetModuleHandle(0);, dann stürzt er mit einer Debug-Exception ab. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /><br />
warum?</p>
<p>Danke.</p>
<p>Danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/192654/speicher-problem-bei-klasse</link><generator>RSS for Node</generator><lastBuildDate>Tue, 30 Jun 2026 18:47:33 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/192654.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 17 Sep 2007 11:00:41 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Speicher problem bei Klasse on Mon, 17 Sep 2007 11:02:03 GMT]]></title><description><![CDATA[<p>Hi @ All.</p>
<p>in der Initialisierungsliste meiner Klasse wird hInstance mit GetModuleHandle(0) initialisiert.</p>
<p>Im konstruktor stimmt der Wert auch noch. (If (hInstance == GetModuleHandle(0)) == true).</p>
<p>Wenn ich aber in einer memberfunc nun diesen Vergleich anstelle, dann ist es = false.</p>
<p>woran kann das liegen?</p>
<pre><code class="language-cpp">// H

#define _WIN32_WINNT 0x0510
#include &lt;windows.h&gt;

#pragma once

class CSettingsWnd
{
public:
	CSettingsWnd(void);
	~CSettingsWnd(void);
	void Show(HWND hParent);

	INT_PTR CALLBACK DialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
	static INT_PTR CALLBACK StaticProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);

private:
	HINSTANCE hInstance;
};

// CPP

#define _WIN32_WINNT 0x0510
#include &lt;windows.h&gt;

#include &quot;SettingsWnd.h&quot;
#include &quot;script.h&quot;

CSettingsWnd::CSettingsWnd(void) : hInstance(GetModuleHandle(0))
{
}

CSettingsWnd::~CSettingsWnd(void)
{
}

void CSettingsWnd::Show(HWND hParent)
{
	// Hier stimmt hInstance nicht mehr mit GetModuleHandle(0) überein.
	DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_SETTINGS), hParent, StaticProc, (long)this);
}
</code></pre>
<p>Woran könnte dass den liegen??<br />
Wenn ich versuche, im Show-Member die hInstance = GetModuleHandle(0);, dann stürzt er mit einer Debug-Exception ab. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /><br />
warum?</p>
<p>Danke.</p>
<p>Danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1366826</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1366826</guid><dc:creator><![CDATA[Script-Styler]]></dc:creator><pubDate>Mon, 17 Sep 2007 11:02:03 GMT</pubDate></item><item><title><![CDATA[Reply to Speicher problem bei Klasse on Mon, 17 Sep 2007 11:09:47 GMT]]></title><description><![CDATA[<p>Script-Styler, Ich habe hier einen Buchtipp für dich:</p>
<p><a href="https://duckduckgo.com/?q=isbn+3826609689&amp;cppnetbooks" rel="nofollow">Programmieren für Kids | ISBN: 3826609689</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1366832</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1366832</guid><dc:creator><![CDATA[tenchou]]></dc:creator><pubDate>Mon, 17 Sep 2007 11:09:47 GMT</pubDate></item><item><title><![CDATA[Reply to Speicher problem bei Klasse on Mon, 17 Sep 2007 11:16:43 GMT]]></title><description><![CDATA[<p>Warum? Was ist falsch?</p>
<p>Ist das alles huddel???</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1366836</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1366836</guid><dc:creator><![CDATA[Script-Styler]]></dc:creator><pubDate>Mon, 17 Sep 2007 11:16:43 GMT</pubDate></item><item><title><![CDATA[Reply to Speicher problem bei Klasse on Mon, 17 Sep 2007 11:19:52 GMT]]></title><description><![CDATA[<p>Was will ich mit &quot;Programmieren für Kinder&quot;???</p>
<p>Meine fresse, für wie blöd haltet ihr mich??? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_down"
      title=":-1:"
      alt="👎"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_down"
      title=":-1:"
      alt="👎"
    /></p>
<p>Gibt es ddenn nicht was vernünftiges, wo WinAPI schritt für schritt erklärt wird? und das als PDF?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1366838</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1366838</guid><dc:creator><![CDATA[Script-Styler]]></dc:creator><pubDate>Mon, 17 Sep 2007 11:19:52 GMT</pubDate></item><item><title><![CDATA[Reply to Speicher problem bei Klasse on Mon, 17 Sep 2007 11:27:36 GMT]]></title><description><![CDATA[<p>Ich muss technou recht geben, mach erstmal das buch für Kids^^.....</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1366851</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1366851</guid><dc:creator><![CDATA[pivke]]></dc:creator><pubDate>Mon, 17 Sep 2007 11:27:36 GMT</pubDate></item><item><title><![CDATA[Reply to Speicher problem bei Klasse on Mon, 17 Sep 2007 12:29:19 GMT]]></title><description><![CDATA[<p>ÜBERREDET.<br />
ich werd mal sehen, wo ich das bekomm.</p>
<p>BackToTopic:</p>
<p>Aber was ist nun falsch?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1366912</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1366912</guid><dc:creator><![CDATA[Script-Styler]]></dc:creator><pubDate>Mon, 17 Sep 2007 12:29:19 GMT</pubDate></item><item><title><![CDATA[Reply to Speicher problem bei Klasse on Mon, 17 Sep 2007 12:43:18 GMT]]></title><description><![CDATA[<p>Also ich versteh dein Problem nicht ganz, aber trotzdem versuch ich dir mal zu helfen.<br />
ich weiss nicht ob man das hier darf, aber ich geb dir mal die icq-nummer von einem Freund der dir bestimmt helfen kann.<br />
Aber sag nicht das du die Nummer von mir hast <sup>_</sup><br />
Adde ihn mal.<br />
317806052<br />
Hofe konnte dir i-wie helfen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1366929</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1366929</guid><dc:creator><![CDATA[pivke]]></dc:creator><pubDate>Mon, 17 Sep 2007 12:43:18 GMT</pubDate></item><item><title><![CDATA[Reply to Speicher problem bei Klasse on Tue, 18 Sep 2007 09:20:06 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/16559">@tenchou</a>:<br />
Wenn du schon einen Buchtipp für mich hast, dann wirst du auch bestimmt wissen wo das Problem liegt.<br />
Es tritt mehrfach auf.<br />
Einmal mit der hInstance und das zweite mal mit einem TCHAR[].<br />
Woran könnte es liegen?<br />
Es kann doch nicht sein, dass ich eine Variable im Konstruktor setze, und sie nicht mehr den selben Zustand hat. Sie st private und so von außeneinwirkungen geschützt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1367522</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1367522</guid><dc:creator><![CDATA[Script-Styler]]></dc:creator><pubDate>Tue, 18 Sep 2007 09:20:06 GMT</pubDate></item><item><title><![CDATA[Reply to Speicher problem bei Klasse on Tue, 18 Sep 2007 09:31:25 GMT]]></title><description><![CDATA[<p>Hast du überhaupt noch das selbe Objekt in der Hand, das oben angelegt wurde?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1367540</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1367540</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Tue, 18 Sep 2007 09:31:25 GMT</pubDate></item><item><title><![CDATA[Reply to Speicher problem bei Klasse on Tue, 18 Sep 2007 09:33:25 GMT]]></title><description><![CDATA[<p>Script-Styler schrieb:</p>
<blockquote>
<pre><code class="language-cpp">INT_PTR CALLBACK DialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
	static INT_PTR CALLBACK StaticProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
</code></pre>
</blockquote>
<p>Für was soll denn das Schlüsselwort <strong>static</strong> bei der Methode StaticProc() gut sein???</p>
<p>Martin</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1367542</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1367542</guid><dc:creator><![CDATA[Mmacher]]></dc:creator><pubDate>Tue, 18 Sep 2007 09:33:25 GMT</pubDate></item><item><title><![CDATA[Reply to Speicher problem bei Klasse on Tue, 18 Sep 2007 09:40:33 GMT]]></title><description><![CDATA[<p>Script-Styler schrieb:</p>
<blockquote>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/16559">@tenchou</a>:<br />
Wenn du schon einen Buchtipp für mich hast, dann wirst du auch bestimmt wissen wo das Problem liegt.</p>
</blockquote>
<p>Ja, der Fehler liegt in deinem Code. Du machst etwas verbotenes, aber das ist nicht ersichtlich aus deinem geposteten Ausschnitt. Hast du das Buch schon durchgearbeitet?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1367553</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1367553</guid><dc:creator><![CDATA[tenchou]]></dc:creator><pubDate>Tue, 18 Sep 2007 09:40:33 GMT</pubDate></item><item><title><![CDATA[Reply to Speicher problem bei Klasse on Tue, 18 Sep 2007 11:42:41 GMT]]></title><description><![CDATA[<p>Das static ist dafür, dass ich die StaticProc in die DialogBox als Parameter aufnehmen kann und die DialogProc ist die Prozedure. Die StaticProc leitet alles an die DialogProc weiter.<br />
Was mache ich denn verbotenes???</p>
<p>Ich rufe vom Hauptdialog aus das Show-Member mit hDlg als Parent auf.<br />
Aber warum verbotenes???</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1367653</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1367653</guid><dc:creator><![CDATA[Script-Styler]]></dc:creator><pubDate>Tue, 18 Sep 2007 11:42:41 GMT</pubDate></item><item><title><![CDATA[Reply to Speicher problem bei Klasse on Tue, 18 Sep 2007 13:55:25 GMT]]></title><description><![CDATA[<p>Ich bin doch kein Hellseher!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1367779</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1367779</guid><dc:creator><![CDATA[tenchou]]></dc:creator><pubDate>Tue, 18 Sep 2007 13:55:25 GMT</pubDate></item></channel></rss>