<?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[Open Dialog einbinden!]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich möchte gerne in meinem Dialogfenster einen Button einbauen, der beim Druck auf diesen, mir ein Dialogfenster aufmacht, in dem ich dann durch meinen Verzeichnisbaum herumgehen kann und dort eine Datei selektieren kann. Nach dem ich dann eine Datei selektiert habe und auf Ok gedrückt habe, soll er den Dateinnamen in ein Textfeld verschieben. Ich habe mir jetzt da die entsprechende Methode aus der MSDN herausgesucht (denk ich mal, dass es die ist), jedoch habe ich das Problem, dass meine Dialoganwendung komplett geschlossen wird...weiss einer ne Antowrt, warum das so ist?</p>
<p>Hier ist der Quellcode:</p>
<pre><code class="language-cpp">OPENFILENAME ofn;       // common dialog box structure
char szFile[260];       // buffer for file name
HWND hwnd;              // owner window
HANDLE hf;              // file handle

// Initialize OPENFILENAME
ZeroMemory(&amp;ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwnd;
ofn.lpstrFile = szFile;
//
// Set lpstrFile[0] to '\0' so that GetOpenFileName does not 
// use the contents of szFile to initialize itself.
//
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = &quot;All\0*.*\0Text\0*.TXT\0&quot;;
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;

// Display the Open dialog box. 

if (GetOpenFileName(&amp;ofn)== TRUE)
    hf = CreateFile(ofn.lpstrFile, GENERIC_READ,
        0, (LPSECURITY_ATTRIBUTES) NULL,
        OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
        (HANDLE) NULL);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/80327/open-dialog-einbinden</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Apr 2026 04:35:26 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/80327.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 20 Jul 2004 09:54:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Open Dialog einbinden! on Tue, 20 Jul 2004 09:54:11 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich möchte gerne in meinem Dialogfenster einen Button einbauen, der beim Druck auf diesen, mir ein Dialogfenster aufmacht, in dem ich dann durch meinen Verzeichnisbaum herumgehen kann und dort eine Datei selektieren kann. Nach dem ich dann eine Datei selektiert habe und auf Ok gedrückt habe, soll er den Dateinnamen in ein Textfeld verschieben. Ich habe mir jetzt da die entsprechende Methode aus der MSDN herausgesucht (denk ich mal, dass es die ist), jedoch habe ich das Problem, dass meine Dialoganwendung komplett geschlossen wird...weiss einer ne Antowrt, warum das so ist?</p>
<p>Hier ist der Quellcode:</p>
<pre><code class="language-cpp">OPENFILENAME ofn;       // common dialog box structure
char szFile[260];       // buffer for file name
HWND hwnd;              // owner window
HANDLE hf;              // file handle

// Initialize OPENFILENAME
ZeroMemory(&amp;ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwnd;
ofn.lpstrFile = szFile;
//
// Set lpstrFile[0] to '\0' so that GetOpenFileName does not 
// use the contents of szFile to initialize itself.
//
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = &quot;All\0*.*\0Text\0*.TXT\0&quot;;
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;

// Display the Open dialog box. 

if (GetOpenFileName(&amp;ofn)== TRUE)
    hf = CreateFile(ofn.lpstrFile, GENERIC_READ,
        0, (LPSECURITY_ATTRIBUTES) NULL,
        OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
        (HANDLE) NULL);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/564292</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/564292</guid><dc:creator><![CDATA[chullain]]></dc:creator><pubDate>Tue, 20 Jul 2004 09:54:11 GMT</pubDate></item><item><title><![CDATA[Reply to Open Dialog einbinden! on Tue, 20 Jul 2004 11:59:35 GMT]]></title><description><![CDATA[<p>weiss da keiner Bescheid?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/564390</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/564390</guid><dc:creator><![CDATA[chullain]]></dc:creator><pubDate>Tue, 20 Jul 2004 11:59:35 GMT</pubDate></item><item><title><![CDATA[Reply to Open Dialog einbinden! on Tue, 20 Jul 2004 12:17:16 GMT]]></title><description><![CDATA[<p>...hat sich erledigt, wenn es einen interessiert...hier der Code</p>
<pre><code class="language-cpp">CFileDialog ldFile(TRUE);

// Show the File Open dialog and capture the result
  if (ldFile.DoModal() == IDOK)
  {
    // Get the file name selected
    m_MFilePath = ldFile.GetFileName();
    // Update the dialog
    UpdateData(FALSE);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/564404</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/564404</guid><dc:creator><![CDATA[chullain]]></dc:creator><pubDate>Tue, 20 Jul 2004 12:17:16 GMT</pubDate></item><item><title><![CDATA[Reply to Open Dialog einbinden! on Tue, 20 Jul 2004 12:31:08 GMT]]></title><description><![CDATA[<p>Das Du hier im vollkommen falschen Forum bist mit Deinem Thema ist Dir aber schon klar, oder?</p>
<p>Nur falls Du Dich wunderst warum im &quot;C++&quot;-Forum keiner eine &quot;MFC mit dem Visual C++&quot;-Frage beantwortet...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/564411</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/564411</guid><dc:creator><![CDATA[Hepi]]></dc:creator><pubDate>Tue, 20 Jul 2004 12:31:08 GMT</pubDate></item><item><title><![CDATA[Reply to Open Dialog einbinden! on Tue, 20 Jul 2004 12:36:35 GMT]]></title><description><![CDATA[<p>war keine Absicht, sorry...bin noch neu, was c++ angeht...hab den Unterschied nicht erkannt...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/564417</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/564417</guid><dc:creator><![CDATA[chullain]]></dc:creator><pubDate>Tue, 20 Jul 2004 12:36:35 GMT</pubDate></item><item><title><![CDATA[Reply to Open Dialog einbinden! on Wed, 21 Jul 2004 11:40:20 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/profile.php?mode=viewprofile&amp;u=403" rel="nofollow">HumeSikkins</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=15" rel="nofollow">C++</a> in das Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=1" rel="nofollow">MFC mit dem Visual C++</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic.php?t=39405" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/565144</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/565144</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Wed, 21 Jul 2004 11:40:20 GMT</pubDate></item></channel></rss>