cht電腦資訊LanguageC/C++
adm Find login register

win32 GetOpenFileName

eliu
1 win32 GetOpenFileName
Promote 0 Bookmark 02009-10-09quote  

Windows win32 想用來選擇 folder/directory 不知道要怎麼做,GetOpenFileName 選folder 然後 click open 會跳到 folder 裏面,不會 close dialog。

BOOL GetOpenFileName(LPOPENFILENAME lpofn);

edited: 2
eliu
2
Promote 0 Bookmark 02009-10-09quote  

用 msdn search 半天找不到,最後用 google 找到  function

PIDLIST_ABSOLUTE SHBrowseForFolder(      
    LPBROWSEINFO lpbi
);

eliu
3
Promote 0 Bookmark 02009-10-13quote  

Example
            BROWSEINFO br;
            ZeroMemory(&br, sizeof(br));
            br.hwndOwner = hWnd;

            char dir[MAXPATH];
            LPITEMIDLIST pIIL = SHBrowseForFolder(&br);
            if(pIIL)
                SHGetPathFromIDList(pIIL, dir);
          
            IMalloc *pmal = 0;
            if(SHGetMalloc(&pmal) == S_OK) {
                pmal->Free(pIIL);
                pmal->Release();
            }

我覺得SHBrowseForFolder這個 function 設計得很爛,很難用。 

edited: 3

cht電腦資訊LanguageC/C++
adm Find login register
views:12659