<?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[Was ist der Unterschied zwischen dem Klick auf einen Toolbarbutton und WM_COMMAND?]]></title><description><![CDATA[<p>Moin!</p>
<p>Ich habe eine SDI mit mehreren Formviews (wie in der FAQ beschrieben).<br />
Wenn ich per Menü oder Toolbar zu einem anderen View umschalte, funktioniert alles super.</p>
<p>Wenn ich aber so umschalte:</p>
<pre><code class="language-cpp">AfxGetMainWnd()-&gt;SendMessage(WM_COMMAND, ID_KUNDENVIEW);
</code></pre>
<p>dann bekomme ich einen ASSERT (Zeile 17).</p>
<pre><code class="language-cpp">void CWnd::AssertValid() const
{
	if (m_hWnd == NULL)
		return;     // null (unattached) windows are valid

	// check for special wnd??? values
	ASSERT(HWND_TOP == NULL);       // same as desktop
	if (m_hWnd == HWND_BOTTOM)
		ASSERT(this == &amp;CWnd::wndBottom);
	else if (m_hWnd == HWND_TOPMOST)
		ASSERT(this == &amp;CWnd::wndTopMost);
	else if (m_hWnd == HWND_NOTOPMOST)
		ASSERT(this == &amp;CWnd::wndNoTopMost);
	else
	{
		// should be a normal window
		ASSERT(::IsWindow(m_hWnd));

		// should also be in the permanent or temporary handle map
		CHandleMap* pMap = afxMapHWND();
		ASSERT(pMap != NULL);

		CObject* p;
		ASSERT((p = pMap-&gt;LookupPermanent(m_hWnd)) != NULL ||
			(p = pMap-&gt;LookupTemporary(m_hWnd)) != NULL);
		ASSERT((CWnd*)p == this);   // must be us

		// Note: if either of the above asserts fire and you are
		// writing a multithreaded application, it is likely that
		// you have passed a C++ object from one thread to another
		// and have used that object in a way that was not intended.
		// (only simple inline wrapper functions should be used)
		//
		// In general, CWnd objects should be passed by HWND from
		// one thread to another.  The receiving thread can wrap
		// the HWND with a CWnd object by using CWnd::FromHandle.
		//
		// It is dangerous to pass C++ objects from one thread to
		// another, unless the objects are designed to be used in
		// such a manner.
	}
}
</code></pre>
<p>Den Kommentar habe ich gesehen, aber ich verwende keine Threads.</p>
<p>Im Callstack ist kein Code von mir zu sehen. <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>CWnd::AssertValid() line 875 + 36 bytes<br />
AfxAssertValidObject(const CObject * 0x01a4e8b0 {CTempWnd hWnd=0x000d0bf8}, const char * 0x5f4cccf0 THIS_FILE, int 2153) line 108<br />
CWnd::GetTopLevelParent() line 2155<br />
CWinThread::PreTranslateMessage(tagMSG * 0x00432b08 {msg=0x00000100 wp=0x0000000d lp=0x001c0001}) line 673 + 8 bytes<br />
CWinThread::PumpMessage() line 841 + 30 bytes<br />
CWinThread::Run() line 480 + 11 bytes<br />
CWinApp::Run() line 400<br />
AfxWinMain(HINSTANCE__ * 0x00400000, HINSTANCE__ * 0x00000000, char * 0x00134045, int 1) line 49 + 11 bytes<br />
WinMain(HINSTANCE__ * 0x00400000, HINSTANCE__ * 0x00000000, char * 0x00134045, int 1) line 30<br />
WinMainCRTStartup() line 330 + 54 bytes</p>
</blockquote>
<p>Wie suche ich den Fehler nun? Wenn ich ihn ignoriere bemerke ich keine Probleme.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/177693/was-ist-der-unterschied-zwischen-dem-klick-auf-einen-toolbarbutton-und-wm_command</link><generator>RSS for Node</generator><lastBuildDate>Tue, 21 Apr 2026 17:01:43 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/177693.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 03 Apr 2007 07:15:55 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Was ist der Unterschied zwischen dem Klick auf einen Toolbarbutton und WM_COMMAND? on Tue, 03 Apr 2007 07:15:55 GMT]]></title><description><![CDATA[<p>Moin!</p>
<p>Ich habe eine SDI mit mehreren Formviews (wie in der FAQ beschrieben).<br />
Wenn ich per Menü oder Toolbar zu einem anderen View umschalte, funktioniert alles super.</p>
<p>Wenn ich aber so umschalte:</p>
<pre><code class="language-cpp">AfxGetMainWnd()-&gt;SendMessage(WM_COMMAND, ID_KUNDENVIEW);
</code></pre>
<p>dann bekomme ich einen ASSERT (Zeile 17).</p>
<pre><code class="language-cpp">void CWnd::AssertValid() const
{
	if (m_hWnd == NULL)
		return;     // null (unattached) windows are valid

	// check for special wnd??? values
	ASSERT(HWND_TOP == NULL);       // same as desktop
	if (m_hWnd == HWND_BOTTOM)
		ASSERT(this == &amp;CWnd::wndBottom);
	else if (m_hWnd == HWND_TOPMOST)
		ASSERT(this == &amp;CWnd::wndTopMost);
	else if (m_hWnd == HWND_NOTOPMOST)
		ASSERT(this == &amp;CWnd::wndNoTopMost);
	else
	{
		// should be a normal window
		ASSERT(::IsWindow(m_hWnd));

		// should also be in the permanent or temporary handle map
		CHandleMap* pMap = afxMapHWND();
		ASSERT(pMap != NULL);

		CObject* p;
		ASSERT((p = pMap-&gt;LookupPermanent(m_hWnd)) != NULL ||
			(p = pMap-&gt;LookupTemporary(m_hWnd)) != NULL);
		ASSERT((CWnd*)p == this);   // must be us

		// Note: if either of the above asserts fire and you are
		// writing a multithreaded application, it is likely that
		// you have passed a C++ object from one thread to another
		// and have used that object in a way that was not intended.
		// (only simple inline wrapper functions should be used)
		//
		// In general, CWnd objects should be passed by HWND from
		// one thread to another.  The receiving thread can wrap
		// the HWND with a CWnd object by using CWnd::FromHandle.
		//
		// It is dangerous to pass C++ objects from one thread to
		// another, unless the objects are designed to be used in
		// such a manner.
	}
}
</code></pre>
<p>Den Kommentar habe ich gesehen, aber ich verwende keine Threads.</p>
<p>Im Callstack ist kein Code von mir zu sehen. <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>CWnd::AssertValid() line 875 + 36 bytes<br />
AfxAssertValidObject(const CObject * 0x01a4e8b0 {CTempWnd hWnd=0x000d0bf8}, const char * 0x5f4cccf0 THIS_FILE, int 2153) line 108<br />
CWnd::GetTopLevelParent() line 2155<br />
CWinThread::PreTranslateMessage(tagMSG * 0x00432b08 {msg=0x00000100 wp=0x0000000d lp=0x001c0001}) line 673 + 8 bytes<br />
CWinThread::PumpMessage() line 841 + 30 bytes<br />
CWinThread::Run() line 480 + 11 bytes<br />
CWinApp::Run() line 400<br />
AfxWinMain(HINSTANCE__ * 0x00400000, HINSTANCE__ * 0x00000000, char * 0x00134045, int 1) line 49 + 11 bytes<br />
WinMain(HINSTANCE__ * 0x00400000, HINSTANCE__ * 0x00000000, char * 0x00134045, int 1) line 30<br />
WinMainCRTStartup() line 330 + 54 bytes</p>
</blockquote>
<p>Wie suche ich den Fehler nun? Wenn ich ihn ignoriere bemerke ich keine Probleme.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1258321</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1258321</guid><dc:creator><![CDATA[estartu]]></dc:creator><pubDate>Tue, 03 Apr 2007 07:15:55 GMT</pubDate></item><item><title><![CDATA[Reply to Was ist der Unterschied zwischen dem Klick auf einen Toolbarbutton und WM_COMMAND? on Wed, 04 Apr 2007 07:10:44 GMT]]></title><description><![CDATA[<p>Hat niemand eine Idee?<br />
Nichtmal, was ich wo gucken könnte?<br />
<img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1258954</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1258954</guid><dc:creator><![CDATA[estartu]]></dc:creator><pubDate>Wed, 04 Apr 2007 07:10:44 GMT</pubDate></item><item><title><![CDATA[Reply to Was ist der Unterschied zwischen dem Klick auf einen Toolbarbutton und WM_COMMAND? on Wed, 04 Apr 2007 07:17:36 GMT]]></title><description><![CDATA[<p>An welcher Stelle in deinem Programm steht denn dieser Aufruf? Das einzige Problem, das mir spontan auffällt, ist, daß du den SendMessage()-Befehl eventuell vor der Erzeugung des Fensters gestartet haben könntest.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1258957</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1258957</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Wed, 04 Apr 2007 07:17:36 GMT</pubDate></item><item><title><![CDATA[Reply to Was ist der Unterschied zwischen dem Klick auf einen Toolbarbutton und WM_COMMAND? on Wed, 04 Apr 2007 07:22:36 GMT]]></title><description><![CDATA[<p>Das SendMessage steht in einer Funktion die vom PreTranslateMessage meines einen Views aufgerufen wird.<br />
Den Mainframe sehe ich zu dem Zeitpunkt schon.</p>
<p>PS: Ich löse das SendMessage ja per Barcodescan aus.<br />
Klicke ich stattdessen in die Toolbar auf die Schaltfläche für den neuen View, dann kommt kein ASSERT.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1258959</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1258959</guid><dc:creator><![CDATA[estartu]]></dc:creator><pubDate>Wed, 04 Apr 2007 07:22:36 GMT</pubDate></item></channel></rss>