<?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[OpenFileDialog erscheint nicht]]></title><description><![CDATA[<p>Hallo alle zusammen,</p>
<p>ich habe folgendes Programm geschrieben das die Funktion erfüllen soll einen<br />
OpenFileDialog zu öffnen in dem der Anwender eine Datei auswählen kann ohne<br />
umständlich den ganzen Pfad in die Console eintippen zu müssen.</p>
<p>Das Programm funktioniert soweit, jedoch scheint er den Dialog zwar zu öffnen,<br />
den das Consolefenster wird inaktiv, jedoch erscheint der Dialog nicht auf dem<br />
Bildschrim und das Programm bleibt einfach stehen.</p>
<p>Vieleicht könnt ihr mir weiterhelfen? Nachfolgend der Code:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;windows.h&gt;

using namespace std;

int main()
{
	cout &lt;&lt; &quot;Test für einen FileOpendialog\n&quot;;

	OPENFILENAME ofn;
    char szFileName[MAX_PATH] = &quot;&quot;;

    ZeroMemory(&amp;ofn, sizeof(ofn));

    ofn.lStructSize = sizeof(ofn); // SEE NOTE BELOW
    ofn.hwndOwner = NULL;
    ofn.lpstrFilter = &quot;Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0&quot;;
    ofn.lpstrFile = szFileName;
    ofn.nMaxFile = MAX_PATH;
	ofn.lpstrFileTitle = NULL;
	ofn.nMaxFileTitle = 0;
    ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
    ofn.lpstrDefExt = &quot;txt&quot;;

    if(GetOpenFileName(&amp;ofn))
    {
        // Do something usefull with the filename stored in szFileName 
		cout &lt;&lt; &quot;Angewaehlte Datei: &quot; &lt;&lt; szFileName &lt;&lt; &quot;\n\n&quot;;
    }
	cout &lt;&lt; &quot;Ende des Dialoges....&quot;;
	system(&quot;pause&quot;);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/218860/openfiledialog-erscheint-nicht</link><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Apr 2026 00:10:25 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/218860.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 26 Jul 2008 15:11:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to OpenFileDialog erscheint nicht on Sat, 26 Jul 2008 15:11:00 GMT]]></title><description><![CDATA[<p>Hallo alle zusammen,</p>
<p>ich habe folgendes Programm geschrieben das die Funktion erfüllen soll einen<br />
OpenFileDialog zu öffnen in dem der Anwender eine Datei auswählen kann ohne<br />
umständlich den ganzen Pfad in die Console eintippen zu müssen.</p>
<p>Das Programm funktioniert soweit, jedoch scheint er den Dialog zwar zu öffnen,<br />
den das Consolefenster wird inaktiv, jedoch erscheint der Dialog nicht auf dem<br />
Bildschrim und das Programm bleibt einfach stehen.</p>
<p>Vieleicht könnt ihr mir weiterhelfen? Nachfolgend der Code:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;windows.h&gt;

using namespace std;

int main()
{
	cout &lt;&lt; &quot;Test für einen FileOpendialog\n&quot;;

	OPENFILENAME ofn;
    char szFileName[MAX_PATH] = &quot;&quot;;

    ZeroMemory(&amp;ofn, sizeof(ofn));

    ofn.lStructSize = sizeof(ofn); // SEE NOTE BELOW
    ofn.hwndOwner = NULL;
    ofn.lpstrFilter = &quot;Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0&quot;;
    ofn.lpstrFile = szFileName;
    ofn.nMaxFile = MAX_PATH;
	ofn.lpstrFileTitle = NULL;
	ofn.nMaxFileTitle = 0;
    ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
    ofn.lpstrDefExt = &quot;txt&quot;;

    if(GetOpenFileName(&amp;ofn))
    {
        // Do something usefull with the filename stored in szFileName 
		cout &lt;&lt; &quot;Angewaehlte Datei: &quot; &lt;&lt; szFileName &lt;&lt; &quot;\n\n&quot;;
    }
	cout &lt;&lt; &quot;Ende des Dialoges....&quot;;
	system(&quot;pause&quot;);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1554020</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1554020</guid><dc:creator><![CDATA[sandkasten]]></dc:creator><pubDate>Sat, 26 Jul 2008 15:11:00 GMT</pubDate></item><item><title><![CDATA[Reply to OpenFileDialog erscheint nicht on Sat, 26 Jul 2008 15:41:41 GMT]]></title><description><![CDATA[<p>Also bei mir funktioniert dein Code einwandfrei... FileDialog erscheint.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1554040</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1554040</guid><dc:creator><![CDATA[JustSomeCoder]]></dc:creator><pubDate>Sat, 26 Jul 2008 15:41:41 GMT</pubDate></item><item><title><![CDATA[Reply to OpenFileDialog erscheint nicht on Sat, 26 Jul 2008 15:48:47 GMT]]></title><description><![CDATA[<p>Bei mir auch... sehr eigenartig. Soweit ich weiß ist das OS technisch nicht sehr anfällig.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1554046</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1554046</guid><dc:creator><![CDATA[kausalitaetsfalle]]></dc:creator><pubDate>Sat, 26 Jul 2008 15:48:47 GMT</pubDate></item><item><title><![CDATA[Reply to OpenFileDialog erscheint nicht on Sat, 26 Jul 2008 15:49:16 GMT]]></title><description><![CDATA[<p>Hmm... seltsam. Eine Idee woran es liegen könnte das es nicht funktioniert?<br />
Kann es am OS liegen? (arbeite auf einem Win2k System)</p>
<p>Danke für die schnelle Antwort!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1554047</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1554047</guid><dc:creator><![CDATA[sandkasten]]></dc:creator><pubDate>Sat, 26 Jul 2008 15:49:16 GMT</pubDate></item><item><title><![CDATA[Reply to OpenFileDialog erscheint nicht on Sat, 26 Jul 2008 16:00:28 GMT]]></title><description><![CDATA[<p>Es wird immer seltsamer, versuchshalber bin ich mal vom Debug in Relase Modus<br />
gewechselt, da hat es einwandfrei funktioniert, nun bin ich wieder in den<br />
Debug zurück gewechselt und nun funktioniert es auch dort *lol*</p>
<p>Ich habe nicht den Code geändert...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1554058</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1554058</guid><dc:creator><![CDATA[sandkasten]]></dc:creator><pubDate>Sat, 26 Jul 2008 16:00:28 GMT</pubDate></item><item><title><![CDATA[Reply to OpenFileDialog erscheint nicht on Sun, 27 Jul 2008 10:12:35 GMT]]></title><description><![CDATA[<p>Müsste der Filter nicht mit einer Doppel-Null abgeschlossen sein?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1554447</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1554447</guid><dc:creator><![CDATA[plaintext]]></dc:creator><pubDate>Sun, 27 Jul 2008 10:12:35 GMT</pubDate></item></channel></rss>