<?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[COleDateTimeSpan::GetDays() in Static Text ausgeben]]></title><description><![CDATA[<p>Hallo Zusammen<br />
Neu hier, und gleich eine Frage!<br />
Ich bin relativ neu in der ganzen MFC Welt, hab vorher ein paar Sachen mit VC++ 6.0 gemacht. Und probiere jetzt ein paar Sachen mit Visual Studio 2005 Express.<br />
Es ist etwas einfaches, funktioniert unter VC++ 6.0 aber nicht in VS Express hier mal mein Code:</p>
<pre><code class="language-cpp">void CTimeDlg::OnTimer(UINT_PTR nIDEvent)
{
	// TODO: Add your message handler code here and/or call default
	COleDateTime dtevent;
	dtevent = COleDateTime(2006, 11, 29, 0, 00, 0);
	COleDateTimeSpan dtDiff = dtevent - COleDateTime::GetCurrentTime();
	CString strMessage;

	strMessage.Format(&quot;%d d, %d h, %d m, %d s&quot;, (int)dtDiff.GetDays(), (int)dtDiff.GetHours(), (int)dtDiff.GetMinutes(), (int)dtDiff.GetSeconds()); //&lt;-- Zeile 99

	m_lbTime = strMessage; //m_lbTime ist eine control variable
	UpdateData(FALSE);

	CDialog::OnTimer(nIDEvent);
}
</code></pre>
<p>So wie der code hier steht funktioniert er in VC++ 6.0 &amp; VS 2003<br />
aber unter 2005 erhalte ich folgender Fehler:</p>
<pre><code>d:\projects\Time\Time\Timedlg.cpp(99) : error C2664: 'void ATL::CStringT&lt;BaseType,StringTraits&gt;::Format(const wchar_t *,...)' : cannot convert parameter 1 from 'const char [23]' to 'const wchar_t *'
        with
        [
            BaseType=wchar_t,
            StringTraits=StrTraitMFC_DLL&lt;wchar_t&gt;
        ]
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
</code></pre>
<p>Bevor ich den Beitrag verfasst habe hab ich noch was intressantes in der FAQ gesehen:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39135.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-t-is-39135.html</a><br />
aber das hat mich auch nicht zum Erfolg gebracht.</p>
<p>Nun was mir die Fehlermeldung sagt ist, das ich vorher etwas casten muss, nur wie und was?</p>
<p>wäre froh wenn mir da jemand helfen könnte</p>
<p>Danke im Voraus<br />
lena</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/150431/coledatetimespan-getdays-in-static-text-ausgeben</link><generator>RSS for Node</generator><lastBuildDate>Wed, 22 Jul 2026 10:58:43 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/150431.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 16 Jun 2006 12:38:21 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to COleDateTimeSpan::GetDays() in Static Text ausgeben on Fri, 16 Jun 2006 12:38:21 GMT]]></title><description><![CDATA[<p>Hallo Zusammen<br />
Neu hier, und gleich eine Frage!<br />
Ich bin relativ neu in der ganzen MFC Welt, hab vorher ein paar Sachen mit VC++ 6.0 gemacht. Und probiere jetzt ein paar Sachen mit Visual Studio 2005 Express.<br />
Es ist etwas einfaches, funktioniert unter VC++ 6.0 aber nicht in VS Express hier mal mein Code:</p>
<pre><code class="language-cpp">void CTimeDlg::OnTimer(UINT_PTR nIDEvent)
{
	// TODO: Add your message handler code here and/or call default
	COleDateTime dtevent;
	dtevent = COleDateTime(2006, 11, 29, 0, 00, 0);
	COleDateTimeSpan dtDiff = dtevent - COleDateTime::GetCurrentTime();
	CString strMessage;

	strMessage.Format(&quot;%d d, %d h, %d m, %d s&quot;, (int)dtDiff.GetDays(), (int)dtDiff.GetHours(), (int)dtDiff.GetMinutes(), (int)dtDiff.GetSeconds()); //&lt;-- Zeile 99

	m_lbTime = strMessage; //m_lbTime ist eine control variable
	UpdateData(FALSE);

	CDialog::OnTimer(nIDEvent);
}
</code></pre>
<p>So wie der code hier steht funktioniert er in VC++ 6.0 &amp; VS 2003<br />
aber unter 2005 erhalte ich folgender Fehler:</p>
<pre><code>d:\projects\Time\Time\Timedlg.cpp(99) : error C2664: 'void ATL::CStringT&lt;BaseType,StringTraits&gt;::Format(const wchar_t *,...)' : cannot convert parameter 1 from 'const char [23]' to 'const wchar_t *'
        with
        [
            BaseType=wchar_t,
            StringTraits=StrTraitMFC_DLL&lt;wchar_t&gt;
        ]
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
</code></pre>
<p>Bevor ich den Beitrag verfasst habe hab ich noch was intressantes in der FAQ gesehen:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39135.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-t-is-39135.html</a><br />
aber das hat mich auch nicht zum Erfolg gebracht.</p>
<p>Nun was mir die Fehlermeldung sagt ist, das ich vorher etwas casten muss, nur wie und was?</p>
<p>wäre froh wenn mir da jemand helfen könnte</p>
<p>Danke im Voraus<br />
lena</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1078857</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1078857</guid><dc:creator><![CDATA[lena]]></dc:creator><pubDate>Fri, 16 Jun 2006 12:38:21 GMT</pubDate></item><item><title><![CDATA[Reply to COleDateTimeSpan::GetDays() in Static Text ausgeben on Fri, 16 Jun 2006 13:16:40 GMT]]></title><description><![CDATA[<p>Per default ist in VC2005 UNICODE aktiviert (was gut ist)... somit musst Du am besten alles mit TCHAR machen =&gt;</p>
<pre><code class="language-cpp">strMessage.Format(_T(&quot;%d d, %d h,...&quot;), ...)
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1078908</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1078908</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Fri, 16 Jun 2006 13:16:40 GMT</pubDate></item><item><title><![CDATA[Reply to COleDateTimeSpan::GetDays() in Static Text ausgeben on Fri, 16 Jun 2006 13:31:18 GMT]]></title><description><![CDATA[<p>Tatsächlich! Vielen Dank Jochen</p>
<p>gruss Lena</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1078931</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1078931</guid><dc:creator><![CDATA[lena]]></dc:creator><pubDate>Fri, 16 Jun 2006 13:31:18 GMT</pubDate></item></channel></rss>