<?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[Formatierung mit einer Variablen und _T()]]></title><description><![CDATA[<p>Hallo</p>
<p>Ich arbeite mit embedded c++ 4.0</p>
<p>da soll per buttonclick ein Datei öffnen dialog geöffnet werden</p>
<p>jetzt hab ich aber das problem, dass er alles an strings egal wo (MessageBoxes etc) mit _T() &quot;umgewandelt&quot; haben will</p>
<p>sprich:</p>
<p>MessageBox(_T(&quot;Fehler&quot;),NULL,MB_OK);</p>
<p>so, da das für die datei öffnen aber ne struktur ist, muss ich dort eine variable damit &quot;umwandeln&quot; lassen.</p>
<p>kann mir jemand sagen wie ich das machen muss?</p>
<p>hier der code</p>
<p>//Header</p>
<pre><code class="language-cpp">typedef struct tagOFN
	{
		DWORD         lStructSize;
		HWND          hwndOwner;
		HINSTANCE     hInstance;
		LPCTSTR       lpstrFilter;
		LPTSTR        lpstrCustomFilter;
		DWORD         nMaxCustFilter;
		DWORD         nFilterIndex;
		LPTSTR        lpstrFile;
		DWORD         nMaxFile;
		LPTSTR        lpstrFileTitle;
		DWORD         nMaxFileTitle;
		LPCTSTR       lpstrInitialDir;
		LPCTSTR       lpstrTitle;
		DWORD         Flags;

		WORD          nFileOffset;
		WORD          nFileExtension;
		LPCTSTR       lpstrDefExt;
		DWORD         lCustData;
		LPOFNHOOKPROC lpfnHook;
		LPCTSTR       lpTemplateName;
	} OPENFILENAME;
</code></pre>
<p>//CPP<br />
[cpp]</p>
<p>void CTestDlg::OnButton3()<br />
{<br />
// TODO: Add your control notification handler code here<br />
//OPENFILE initialisieren<br />
char DateiName[_MAX_PATH+1] = &quot;&quot;;<br />
ofn.lStructSize = sizeof (OPENFILENAME);<br />
ofn.hwndOwner = NULL;<br />
ofn.nMaxFile = _MAX_PATH;<br />
<strong>ofn.lpstrFile = DateiName;</strong> //diese Zeile muss gewandelt werden<br />
ofn.lpstrFilter = _T(&quot;All Files (<em>.</em>)\0*.*\0&quot;);</p>
<p>//Get Filename<br />
GetOpenFileName(&amp;ofn);</p>
<p>m_strFileName.Format(_T(&quot;%s&quot;),ofn.lpstrFile);<br />
}<br />
[/cpp]</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/142957/formatierung-mit-einer-variablen-und-_t</link><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Jul 2026 13:59:42 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/142957.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 04 Apr 2006 15:51:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Formatierung mit einer Variablen und _T() on Tue, 04 Apr 2006 15:54:10 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Ich arbeite mit embedded c++ 4.0</p>
<p>da soll per buttonclick ein Datei öffnen dialog geöffnet werden</p>
<p>jetzt hab ich aber das problem, dass er alles an strings egal wo (MessageBoxes etc) mit _T() &quot;umgewandelt&quot; haben will</p>
<p>sprich:</p>
<p>MessageBox(_T(&quot;Fehler&quot;),NULL,MB_OK);</p>
<p>so, da das für die datei öffnen aber ne struktur ist, muss ich dort eine variable damit &quot;umwandeln&quot; lassen.</p>
<p>kann mir jemand sagen wie ich das machen muss?</p>
<p>hier der code</p>
<p>//Header</p>
<pre><code class="language-cpp">typedef struct tagOFN
	{
		DWORD         lStructSize;
		HWND          hwndOwner;
		HINSTANCE     hInstance;
		LPCTSTR       lpstrFilter;
		LPTSTR        lpstrCustomFilter;
		DWORD         nMaxCustFilter;
		DWORD         nFilterIndex;
		LPTSTR        lpstrFile;
		DWORD         nMaxFile;
		LPTSTR        lpstrFileTitle;
		DWORD         nMaxFileTitle;
		LPCTSTR       lpstrInitialDir;
		LPCTSTR       lpstrTitle;
		DWORD         Flags;

		WORD          nFileOffset;
		WORD          nFileExtension;
		LPCTSTR       lpstrDefExt;
		DWORD         lCustData;
		LPOFNHOOKPROC lpfnHook;
		LPCTSTR       lpTemplateName;
	} OPENFILENAME;
</code></pre>
<p>//CPP<br />
[cpp]</p>
<p>void CTestDlg::OnButton3()<br />
{<br />
// TODO: Add your control notification handler code here<br />
//OPENFILE initialisieren<br />
char DateiName[_MAX_PATH+1] = &quot;&quot;;<br />
ofn.lStructSize = sizeof (OPENFILENAME);<br />
ofn.hwndOwner = NULL;<br />
ofn.nMaxFile = _MAX_PATH;<br />
<strong>ofn.lpstrFile = DateiName;</strong> //diese Zeile muss gewandelt werden<br />
ofn.lpstrFilter = _T(&quot;All Files (<em>.</em>)\0*.*\0&quot;);</p>
<p>//Get Filename<br />
GetOpenFileName(&amp;ofn);</p>
<p>m_strFileName.Format(_T(&quot;%s&quot;),ofn.lpstrFile);<br />
}<br />
[/cpp]</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1030377</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1030377</guid><dc:creator><![CDATA[MSS-Software]]></dc:creator><pubDate>Tue, 04 Apr 2006 15:54:10 GMT</pubDate></item><item><title><![CDATA[Reply to Formatierung mit einer Variablen und _T() on Tue, 04 Apr 2006 16:27:05 GMT]]></title><description><![CDATA[<p>Warum definierst Du &quot;DateiName&quot; als &quot;char&quot;??? Das ist natprlich ein grosser Bruch... und macht das ganze UNICODE wieder zu nichte...<br />
Definiere es bitte als TCHAR...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1030406</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1030406</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Tue, 04 Apr 2006 16:27:05 GMT</pubDate></item><item><title><![CDATA[Reply to Formatierung mit einer Variablen und _T() on Tue, 04 Apr 2006 20:56:51 GMT]]></title><description><![CDATA[<p>jo, alles klar</p>
<p>danke dir</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1030644</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1030644</guid><dc:creator><![CDATA[MSS-Software]]></dc:creator><pubDate>Tue, 04 Apr 2006 20:56:51 GMT</pubDate></item></channel></rss>