<?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[CFileDialog NUR mit pfad?]]></title><description><![CDATA[<p>Ich suche eine möglichkeit, dass ich den CFileDialog so aufrufe, dass ich nicht eine Datei, sondern nur den pfad aufrufe. Im Prinzip so, dass ich wie in CFileDialog die Zieldatei angeben. Halt nur dass ich NUR den Phad angebe.</p>
<p>Gibt es da eine vorgefertigt Funktion in MFC oder geht das nur über den Weg:</p>
<p>CFileDialog öffnen und dann den Pfad der Datei mit GetPathName() holen.</p>
<p>Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/168074/cfiledialog-nur-mit-pfad</link><generator>RSS for Node</generator><lastBuildDate>Fri, 01 May 2026 08:48:28 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/168074.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 18 Dec 2006 12:46:22 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CFileDialog NUR mit pfad? on Mon, 18 Dec 2006 12:46:22 GMT]]></title><description><![CDATA[<p>Ich suche eine möglichkeit, dass ich den CFileDialog so aufrufe, dass ich nicht eine Datei, sondern nur den pfad aufrufe. Im Prinzip so, dass ich wie in CFileDialog die Zieldatei angeben. Halt nur dass ich NUR den Phad angebe.</p>
<p>Gibt es da eine vorgefertigt Funktion in MFC oder geht das nur über den Weg:</p>
<p>CFileDialog öffnen und dann den Pfad der Datei mit GetPathName() holen.</p>
<p>Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1193950</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1193950</guid><dc:creator><![CDATA[Uruk-h4j]]></dc:creator><pubDate>Mon, 18 Dec 2006 12:46:22 GMT</pubDate></item><item><title><![CDATA[Reply to CFileDialog NUR mit pfad? on Mon, 18 Dec 2006 12:54:29 GMT]]></title><description><![CDATA[<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /><br />
willst du das CFileDialog dir nur den pfad zurückgibt oder willst du das du unter CFileDialog nur den pfad wählen kannst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1193958</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1193958</guid><dc:creator><![CDATA[LowFly]]></dc:creator><pubDate>Mon, 18 Dec 2006 12:54:29 GMT</pubDate></item><item><title><![CDATA[Reply to CFileDialog NUR mit pfad? on Mon, 18 Dec 2006 13:01:54 GMT]]></title><description><![CDATA[<p>Na am besten wäre beides!<br />
Aber ich hab GetFolderPath() shon gefunden....fehlr nur noch das ich nur den Pfad wählen kann</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1193966</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1193966</guid><dc:creator><![CDATA[Uruk-h4j]]></dc:creator><pubDate>Mon, 18 Dec 2006 13:01:54 GMT</pubDate></item><item><title><![CDATA[Reply to CFileDialog NUR mit pfad? on Mon, 18 Dec 2006 13:06:52 GMT]]></title><description><![CDATA[<p>Boah, so ohne Suche is das Finden echt mühselig. <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 />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39127.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-t-is-39127.html</a> :xmas1:</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1193969</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1193969</guid><dc:creator><![CDATA[estartu]]></dc:creator><pubDate>Mon, 18 Dec 2006 13:06:52 GMT</pubDate></item><item><title><![CDATA[Reply to CFileDialog NUR mit pfad? on Mon, 18 Dec 2006 13:12:37 GMT]]></title><description><![CDATA[<p>ha die suche bemüht, aber mit dem flaschen stichwort....*CFileDialog* und *CFile*...</p>
<p>Aber Danke trotzdem <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1193973</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1193973</guid><dc:creator><![CDATA[Uruk-h4j]]></dc:creator><pubDate>Mon, 18 Dec 2006 13:12:37 GMT</pubDate></item><item><title><![CDATA[Reply to CFileDialog NUR mit pfad? on Mon, 18 Dec 2006 13:14:33 GMT]]></title><description><![CDATA[<p>Uruk-h4j schrieb:</p>
<blockquote>
<p>ha die suche bemüht, aber mit dem flaschen stichwort....*CFileDialog* und *CFile*...</p>
<p>Aber Danke trotzdem <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
</blockquote>
<p>Die Suche ist kaputt. Deswegen brauchte ich ja auch so lange, bis ich den Link endlich hatte.<br />
Es war ausnahmsweise keine Anspielung, dass du selber suchen solltest. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1193977</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1193977</guid><dc:creator><![CDATA[estartu]]></dc:creator><pubDate>Mon, 18 Dec 2006 13:14:33 GMT</pubDate></item><item><title><![CDATA[Reply to CFileDialog NUR mit pfad? on Mon, 18 Dec 2006 13:55:37 GMT]]></title><description><![CDATA[<p>hmmm...hab mal frecherweise die .cpp und .h kopiert und komischerweise hab ich so ca. 34 Fehler. Ich hab nichts verändert oder sonst was gemacht.</p>
<p>Die sind alle in dem Bereich:</p>
<pre><code class="language-cpp">int __stdcall CDirDialog::BrowseCtrlCallback(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
{
   CDirDialog* pDirDialogObj = (CDirDialog*)lpData;
   if (uMsg == BFFM_INITIALIZED )
   {
       if( ! pDirDialogObj-&amp;gt;m_strSelDir.IsEmpty() )
           ::SendMessage(hwnd, BFFM_SETSELECTION, TRUE, (LPARAM)(LPCTSTR)(pDirDialogObj-&amp;gt;m_strSelDir));
       if( ! pDirDialogObj-&amp;gt;m_strWindowTitle.IsEmpty() )
           ::SetWindowText(hwnd, (LPCTSTR) pDirDialogObj-&amp;gt;m_strWindowTitle);
   }
   else if( uMsg == BFFM_SELCHANGED )
   {
       LPITEMIDLIST pidl = (LPITEMIDLIST) lParam;
       char selection[MAX_PATH];
       if( ! ::SHGetPathFromIDList(pidl, selection) )
           selection[0] = '\0';

       CString csStatusText;
       BOOL bOk = pDirDialogObj-&amp;gt;SelChanged(selection, csStatusText);

       if( pDirDialogObj-&amp;gt;m_bStatus )
           ::SendMessage(hwnd, BFFM_SETSTATUSTEXT , 0, (LPARAM)(LPCSTR)csStatusText);

       ::SendMessage(hwnd, BFFM_ENABLEOK, 0, bOk);
   }
 return 0;
</code></pre>
<p>Irgendwas mit der Variable &quot;gt&quot; passt nicht.<br />
&quot;warning C4067: Unerwartete Token nach Präprozessordirektive - Zeilenvorschub erwartet.&quot;</p>
<pre><code class="language-cpp">#if _MSC_VER &amp;gt;= 1000
#pragma once
#endif // _MSC_VER &amp;gt;= 1000
</code></pre>
<p>Bin ich zu doof zumm STG-C STRG-V ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1194005</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1194005</guid><dc:creator><![CDATA[Uruk-h4j]]></dc:creator><pubDate>Mon, 18 Dec 2006 13:55:37 GMT</pubDate></item><item><title><![CDATA[Reply to CFileDialog NUR mit pfad? on Mon, 18 Dec 2006 14:03:01 GMT]]></title><description><![CDATA[<p>Uruk-h4j schrieb:</p>
<blockquote>
<p>Irgendwas mit der Variable &quot;gt&quot; passt nicht.<br />
&quot;warning C4067: Unerwartete Token nach Präprozessordirektive - Zeilenvorschub erwartet.&quot;</p>
<pre><code class="language-cpp">#if _MSC_VER &amp;gt;= 1000
#pragma once
#endif // _MSC_VER &amp;gt;= 1000
</code></pre>
<p>Bin ich zu doof zumm STG-C STRG-V ?</p>
</blockquote>
<p>Das war keine Variable, das war HTML.<br />
Da scheint mal was die Beiträge teilweise zerschossen zu haben.</p>
<p>Guck nochmal in die FAQ, ich habs repariert. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1194015</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1194015</guid><dc:creator><![CDATA[estartu]]></dc:creator><pubDate>Mon, 18 Dec 2006 14:03:01 GMT</pubDate></item><item><title><![CDATA[Reply to CFileDialog NUR mit pfad? on Mon, 18 Dec 2006 15:05:33 GMT]]></title><description><![CDATA[<p>Jo DER Fehler ist weg, aber ein problem ist noch:</p>
<p>Dadurch, dass da nun keine var gt mehr ist stimmt das hier irgendwe net mehr so:</p>
<pre><code class="language-cpp">int __stdcall CDirDialog::BrowseCtrlCallback(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
{
   CDirDialog* pDirDialogObj = (CDirDialog*)lpData;
   if (uMsg == BFFM_INITIALIZED )
   {
       if( ! pDirDialogObj-&amp;gt;m_strSelDir.IsEmpty() )
           ::SendMessage(hwnd, BFFM_SETSELECTION, TRUE, (LPARAM)(LPCTSTR)(pDirDialogObj-&amp;gt;m_strSelDir));
       if( ! pDirDialogObj-&amp;gt;m_strWindowTitle.IsEmpty() )
           ::SetWindowText(hwnd, (LPCTSTR) pDirDialogObj-&amp;gt;m_strWindowTitle);
   }
   else if( uMsg == BFFM_SELCHANGED )
   {
       LPITEMIDLIST pidl = (LPITEMIDLIST) lParam;
       char selection[MAX_PATH];
       if( ! ::SHGetPathFromIDList(pidl, selection) )
           selection[0] = '\0';

       CString csStatusText;
       BOOL bOk = pDirDialogObj-&amp;gt;SelChanged(selection, csStatusText);

       if( pDirDialogObj-&amp;gt;m_bStatus )
           ::SendMessage(hwnd, BFFM_SETSTATUSTEXT , 0, (LPARAM)(LPCSTR)csStatusText);

       ::SendMessage(hwnd, BFFM_ENABLEOK, 0, bOk);
   }
 return 0;
}
</code></pre>
<p>Wel da wir überall auf gt zugegriffen. Gehört das auch noch zu HTML oder muss ich gt neu zuweisen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1194058</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1194058</guid><dc:creator><![CDATA[Uruk-h4j]]></dc:creator><pubDate>Mon, 18 Dec 2006 15:05:33 GMT</pubDate></item><item><title><![CDATA[Reply to CFileDialog NUR mit pfad? on Mon, 18 Dec 2006 15:56:10 GMT]]></title><description><![CDATA[<p>so hab alle &quot;-gt&quot; entfernt und alles angepasst. Läuft auch alles wie es scheint. Vielleicht sollte man das mal im FAQ ändern !?</p>
<p>Header:</p>
<pre><code class="language-cpp">#if !defined(AFX_DIRDIALOG_H__62FFAC92_1DEE_11D1_B87A_0060979CDF6D__INCLUDED_)
#define AFX_DIRDIALOG_H__62FFAC92_1DEE_11D1_B87A_0060979CDF6D__INCLUDED_

#if _MSC_VER &gt;= 1000
#pragma once
#endif // _MSC_VER &gt;= 1000 

class CDirDialog
{
public:

   CDirDialog();
   virtual ~CDirDialog();

   BOOL DoBrowse(CWnd *pwndParent = NULL);

   CString m_strWindowTitle;
   CString m_strPath;
   CString m_strInitDir;
   CString m_strSelDir;
   CString m_strTitle;
   int  m_iImageIndex;
   BOOL m_bStatus;

private:

   virtual BOOL SelChanged(LPCSTR lpcsSelection, CString &amp;csStatusText) { return TRUE; };
   static int __stdcall CDirDialog::BrowseCtrlCallback(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData);
};

#endif // !defined(AFX_DIRDIALOG_H__62FFAC92_1DEE_11D1_B87A_0060979CDF6D__INCLUDED_)
</code></pre>
<p>CPP:</p>
<pre><code class="language-cpp">#include &quot;stdafx.h&quot;
#include &quot;DirDialog.h&quot;
#include &quot;shlobj.h&quot;

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

int __stdcall CDirDialog::BrowseCtrlCallback(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
{
   CDirDialog* pDirDialogObj = (CDirDialog*)lpData;
   if (uMsg == BFFM_INITIALIZED )
   {
       if( !pDirDialogObj-&gt;m_strSelDir == NULL )
           ::SendMessage(hwnd, BFFM_SETSELECTION, TRUE,(LPARAM)(LPCTSTR)(pDirDialogObj-&gt;m_strSelDir));
       if( !pDirDialogObj-&gt;m_strWindowTitle == NULL )
           ::SetWindowText(hwnd, pDirDialogObj-&gt;m_strWindowTitle);
   }
   else if( uMsg == BFFM_SELCHANGED )
   {
       LPITEMIDLIST pidl = (LPITEMIDLIST) lParam;
       char selection[MAX_PATH];
       if( ! ::SHGetPathFromIDList(pidl, selection) )
           selection[0] = '\0';

      CString csStatusText;
	   BOOL bOk = pDirDialogObj-&gt;SelChanged(selection, csStatusText);

       if( pDirDialogObj-&gt;m_bStatus )
           ::SendMessage(hwnd, BFFM_SETSTATUSTEXT , 0, (LPARAM)(LPCSTR)csStatusText);

       ::SendMessage(hwnd, BFFM_ENABLEOK, 0, bOk);
   }
 return 0;
}

CDirDialog::CDirDialog()
{
   m_bStatus = FALSE;
}

CDirDialog::~CDirDialog()
{
}

BOOL CDirDialog::DoBrowse(CWnd *pwndParent)
{

   if( ! m_strSelDir.IsEmpty() )
   {
       m_strSelDir.TrimRight();
       if( m_strSelDir.Right(1) == &quot;\\&quot; | m_strSelDir.Right(1) == &quot;//&quot; )
           m_strSelDir = m_strSelDir.Left(m_strSelDir.GetLength() - 1);
   }

   LPMALLOC pMalloc;
   if (SHGetMalloc (&amp;pMalloc)!= NOERROR)
       return FALSE;

   BROWSEINFO bInfo;
   LPITEMIDLIST pidl;
   ZeroMemory ( (PVOID) &amp;bInfo,sizeof (BROWSEINFO));

   if (!m_strInitDir.IsEmpty ())
   {
       OLECHAR       olePath[MAX_PATH];
       ULONG         chEaten;
       ULONG         dwAttributes;
       HRESULT       hr;
       LPSHELLFOLDER pDesktopFolder;
       //
       // Get a pointer to the Desktop's IShellFolder interface.
       //
       if (SUCCEEDED(SHGetDesktopFolder(&amp;pDesktopFolder)))
       {
           //
           // IShellFolder::ParseDisplayName requires the file name be in Unicode.
           //
           MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, m_strInitDir.GetBuffer(MAX_PATH), -1, olePath, MAX_PATH);

           m_strInitDir.ReleaseBuffer (-1);
           //
           // Convert the path to an ITEMIDLIST.
           //
           hr = pDesktopFolder-&gt;ParseDisplayName(NULL, NULL, olePath, &amp;chEaten, &amp;pidl, &amp;dwAttributes);
           if (FAILED(hr))
           {
              pMalloc-&gt;Free (pidl);
              pMalloc-&gt;Release ();
               return FALSE;
           }
           bInfo.pidlRoot = pidl;

       }
   }
   bInfo.hwndOwner = pwndParent == NULL ? NULL : pwndParent-&gt;GetSafeHwnd();
   bInfo.pszDisplayName = m_strPath.GetBuffer (MAX_PATH);
   bInfo.lpszTitle = (m_strTitle.IsEmpty()) ? &quot;Open&quot; : m_strTitle;
   bInfo.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS | (m_bStatus ? BIF_STATUSTEXT : 0);

   bInfo.lpfn = BrowseCtrlCallback;  // address of callback function
   bInfo.lParam = (LPARAM)this;      // pass address of object to callback function

   if ((pidl = ::SHBrowseForFolder(&amp;bInfo)) == NULL)
   {
       return FALSE;
   }
   m_strPath.ReleaseBuffer();
   m_iImageIndex = bInfo.iImage;

   if (::SHGetPathFromIDList(pidl, m_strPath.GetBuffer(MAX_PATH)) == FALSE)
   {
       pMalloc-&gt;Free(pidl);
       pMalloc-&gt;Release();
       return FALSE;
   }

   m_strPath.ReleaseBuffer();

   pMalloc-&gt;Free(pidl);
   pMalloc-&gt;Release();

   return TRUE;
}
</code></pre>
<p>Mich wunderts aber, dass so eine Klasse nicht in MFC integriert ist...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1194087</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1194087</guid><dc:creator><![CDATA[Uruk-h4j]]></dc:creator><pubDate>Mon, 18 Dec 2006 15:56:10 GMT</pubDate></item><item><title><![CDATA[Reply to CFileDialog NUR mit pfad? on Mon, 18 Dec 2006 16:49:38 GMT]]></title><description><![CDATA[<p>Nun eine Klasse gibts dafür nicht aber es gibt doch SHBrowseForFolder(..) <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
<p>Bsp.:</p>
<pre><code class="language-cpp">CoInitialize(NULL); //funktioniert auch ohne diesen Aufruf
    BROWSEINFO bi;
    memset( &amp;bi, 0, sizeof( BROWSEINFO ) );
    bi.hwndOwner = AfxGetMainWnd()-&gt;GetSafeHwnd();
    bi.lpszTitle = &quot;Bitte wählen Sie ein Verzeichnis...&quot;;
    bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE;

    ITEMIDLIST* pList = SHBrowseForFolder( &amp;bi );
    if( pList )
        {
            char szFolder[MAX_PATH+1]=&quot;&quot;;
            if( SHGetPathFromIDList( pList, szFolder) )
                {
                   m_sPath = szFolder;
				   this-&gt;SetDlgItemTextA(IDC_STATIC, m_sPath );
                }

            LPMALLOC pMalloc=NULL;
            if( S_OK == SHGetMalloc( &amp;pMalloc ) )
                {
                    pMalloc-&gt;Free( pList );
                    pMalloc-&gt;Release();
                }
        }
    CoUninitialize();
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1194130</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1194130</guid><dc:creator><![CDATA[connan]]></dc:creator><pubDate>Mon, 18 Dec 2006 16:49:38 GMT</pubDate></item><item><title><![CDATA[Reply to CFileDialog NUR mit pfad? on Tue, 19 Dec 2006 08:34:19 GMT]]></title><description><![CDATA[<p>Ah...das ist natürlich kürzer ^^<br />
Und auch das was ich suche. Hat a auch den selben effekt, wie die Klasse auf der ersten Seite. THX!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1194469</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1194469</guid><dc:creator><![CDATA[Uruk-h4j]]></dc:creator><pubDate>Tue, 19 Dec 2006 08:34:19 GMT</pubDate></item></channel></rss>