<?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[error C2664]]></title><description><![CDATA[<p>hallo.</p>
<p>ich habe eine frage zu folgender methode:</p>
<pre><code class="language-cpp">int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

	// create a view to occupy the client area of the frame
	if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
		CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
	{
		TRACE0(&quot;Failed to create view window\n&quot;);
		return -1;
	}

    m_wndChild1.Create(NULL,&quot;MyChild1&quot;,WS_CHILD|WS_VISIBLE,
                       CRect(10,10,300,200),this,1,NULL);
    m_wndChild2.Create(NULL,&quot;MyChild2&quot;,WS_CHILD|WS_VISIBLE,
                       CRect(50,50,340,240),this,2,NULL);

	return 0;
}
</code></pre>
<p>warum erhalte ich für &quot;MyChild1&quot; und &quot;MyChild2&quot; folgende fehlermeldungen, obwohl ich das beispiel aus einem tutorial übernommen habe?</p>
<blockquote>
<p>error C2664: 'CWnd::Create' : cannot convert parameter 2 from 'const char [9]' to 'LPCTSTR'</p>
</blockquote>
<p>liegt das vielleicht daran, dass ich einen neueren compiler nutze als der autor?</p>
<p>DANKE.<br />
STICK.</p>
<p>EDIT:<br />
ich denke, dass mit oben beschriebenem problem auch die fehlermeldung</p>
<blockquote>
<p>error C2440: 'initializing' : cannot convert from 'LPWSTR' to 'char *'</p>
</blockquote>
<p>für den code</p>
<pre><code class="language-cpp">static const char* m_acSYSICONS[] = {IDI_APPLICATION,IDI_INFORMATION,
                                         IDI_WARNING,IDI_ERROR,
                                         IDI_QUESTION,IDI_WINLOGO};
</code></pre>
<p>eng verknüpft ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/164945/error-c2664</link><generator>RSS for Node</generator><lastBuildDate>Fri, 31 Jul 2026 04:05:53 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/164945.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 14 Nov 2006 03:01:36 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to error C2664 on Tue, 14 Nov 2006 04:00:08 GMT]]></title><description><![CDATA[<p>hallo.</p>
<p>ich habe eine frage zu folgender methode:</p>
<pre><code class="language-cpp">int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

	// create a view to occupy the client area of the frame
	if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
		CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
	{
		TRACE0(&quot;Failed to create view window\n&quot;);
		return -1;
	}

    m_wndChild1.Create(NULL,&quot;MyChild1&quot;,WS_CHILD|WS_VISIBLE,
                       CRect(10,10,300,200),this,1,NULL);
    m_wndChild2.Create(NULL,&quot;MyChild2&quot;,WS_CHILD|WS_VISIBLE,
                       CRect(50,50,340,240),this,2,NULL);

	return 0;
}
</code></pre>
<p>warum erhalte ich für &quot;MyChild1&quot; und &quot;MyChild2&quot; folgende fehlermeldungen, obwohl ich das beispiel aus einem tutorial übernommen habe?</p>
<blockquote>
<p>error C2664: 'CWnd::Create' : cannot convert parameter 2 from 'const char [9]' to 'LPCTSTR'</p>
</blockquote>
<p>liegt das vielleicht daran, dass ich einen neueren compiler nutze als der autor?</p>
<p>DANKE.<br />
STICK.</p>
<p>EDIT:<br />
ich denke, dass mit oben beschriebenem problem auch die fehlermeldung</p>
<blockquote>
<p>error C2440: 'initializing' : cannot convert from 'LPWSTR' to 'char *'</p>
</blockquote>
<p>für den code</p>
<pre><code class="language-cpp">static const char* m_acSYSICONS[] = {IDI_APPLICATION,IDI_INFORMATION,
                                         IDI_WARNING,IDI_ERROR,
                                         IDI_QUESTION,IDI_WINLOGO};
</code></pre>
<p>eng verknüpft ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1174122</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1174122</guid><dc:creator><![CDATA[stick_thai]]></dc:creator><pubDate>Tue, 14 Nov 2006 04:00:08 GMT</pubDate></item><item><title><![CDATA[Reply to error C2664 on Tue, 14 Nov 2006 08:31:13 GMT]]></title><description><![CDATA[<p>Ich tippe mal auf ein Problem mit UNICODE vs. ANSI. (wenn du dein Programm als UNICODE compilierst, verwenden/erwarten viele Funktionen wchar_t Eingaben - und die sind nur bedingt kompatibel zu char). Als Lösung kannst du dafür sorgen, daß dein gesamtes Programm mit UNICODE zurechtkommt:</p>
<pre><code class="language-cpp">m_wndChild1.Create(NULL,_T(&quot;MyChild1&quot;),WS_CHILD|WS_VISIBLE,
                       CRect(10,10,300,200),this,1,NULL);
</code></pre>
<pre><code class="language-cpp">static LPCSTR m_acSYSICONS[] = {IDI_APPLICATION,IDI_INFORMATION,
                                IDI_WARNING,IDI_ERROR,
                                IDI_QUESTION,IDI_WINLOGO};
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1174221</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1174221</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Tue, 14 Nov 2006 08:31:13 GMT</pubDate></item><item><title><![CDATA[Reply to error C2664 on Tue, 14 Nov 2006 08:45:08 GMT]]></title><description><![CDATA[<p>danke für die antwort, aber was ist den der unterschied zwischen UNICODE und ANSI? wie kriege ich raus, wie ich mein programm kompiliere?</p>
<p>DANKE.<br />
STICK.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1174234</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1174234</guid><dc:creator><![CDATA[stick_thai]]></dc:creator><pubDate>Tue, 14 Nov 2006 08:45:08 GMT</pubDate></item><item><title><![CDATA[Reply to error C2664 on Tue, 14 Nov 2006 08:58:23 GMT]]></title><description><![CDATA[<p>stick_thai schrieb:</p>
<blockquote>
<p>danke für die antwort, aber was ist den der unterschied zwischen UNICODE und ANSI?</p>
</blockquote>
<p>Schau mal ins Magazin, da stehen einige Artikel zum Thema UNICODE. (der wesentliche Unterschied ist die Größe eines 'Zeichens' - ANSI-Programme verwenden char (1 Byte), UNICODE-Programme wchar_t (2+ Bytes) und können entsprechend mehr Zeichen darstellen.</p>
<blockquote>
<p>wie kriege ich raus, wie ich mein programm kompiliere?</p>
</blockquote>
<p>Das müsste irgendwo in den Compiler-Optionen einstellbar sein.<br />
(und notfalls erkennst du es auch an den Fehlermeldungen - wenn char's nicht nach LPCSTR umgewandelt werden können, arbeitest du mit UNICODE, genauso wenn in deinen Fehlermeldungen Funktionsnamen mit W am Ende auftauchen).</p>
<p>Aber sicherer ist es, dafür zu sorgen, daß dir das egal sein kann, indem du TCHAR und seine Verwandten anstelle von char verwendest.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1174247</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1174247</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Tue, 14 Nov 2006 08:58:23 GMT</pubDate></item><item><title><![CDATA[Reply to error C2664 on Wed, 15 Nov 2006 09:28:25 GMT]]></title><description><![CDATA[<p>Hallo CStoll,</p>
<p>sehe gerade, dass es zu meinem problem auch was im internet gibt:<br />
<a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=849851&amp;SiteID=1" rel="nofollow">http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=849851&amp;SiteID=1</a></p>
<p>hätte vielleicht vorher mal ausführlicher suchen sollen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /><br />
trotzdem danke!</p>
<p>STICK.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1174982</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1174982</guid><dc:creator><![CDATA[*stick_thai]]></dc:creator><pubDate>Wed, 15 Nov 2006 09:28:25 GMT</pubDate></item></channel></rss>