|
Select Folder Dialog
#435948
01/16/14 12:53
01/16/14 12:53
|
Joined: Aug 2002
Posts: 3,258 Mainz
oliver2s
OP
Expert
|
OP
Expert
Joined: Aug 2002
Posts: 3,258
Mainz
|
This functions opens a Windows Dialog in which you can select a folder and get the full path as string. For more info: http://msdn.microsoft.com/en-us/library/windows/desktop/bb773205(v=vs.85).aspx http://msdn.microsoft.com/en-us/library/windows/desktop/bb762115(v=vs.85).aspx http://msdn.microsoft.com/en-us/library/windows/desktop/bb762194(v=vs.85).aspx
typedef struct _BROWSEINFO
{
long hwndOwner;
char* pidlRoot;
char* pszDisplayName;
char* lpszTitle;
long ulFlags;
long lpfn;
long lParam;
int iImage;
}BROWSEINFO;
DWORD WINAPI SHBrowseForFolder(DWORD);
DWORD WINAPI SHGetPathFromIDList(long,long);
API(SHBrowseForFolder,shell32)
API(SHGetPathFromIDList,shell32)
#define PRAGMA_API SHBrowseForFolder;shell32!SHBrowseForFolderA
#define PRAGMA_API SHGetPathFromIDList;shell32!SHGetPathFromIDListA
#define BIF_RETURNONLYFSDIRS 0x00000001
#define BIF_DONTGOBELOWDOMAIN 0x00000002
#define BIF_STATUSTEXT 0x00000004
#define BIF_RETURNFSANCESTORS 0x00000008
#define BIF_EDITBOX 0x00000010
#define BIF_VALIDATE 0x00000020
#define BIF_NEWDIALOGSTYLE 0x00000040
#define BIF_BROWSEINCLUDEURLS 0x00000080
#define BIF_UAHINT 0x00000100
#define BIF_NONEWFOLDERBUTTON 0x00000200
#define BIF_NOTRANSLATETARGETS 0x00000400
#define BIF_BROWSEFORCOMPUTER 0x00001000
#define BIF_BROWSEFORPRINTER 0x00002000
#define BIF_BROWSEINCLUDEFILES 0x00004000
#define BIF_SHAREABLE 0x00008000
#define BIF_BROWSEFILEJUNCTIONS 0x00010000
function folder_dialog(STRING* dir)
{
STRING* DirName = str_create("#255"); *DirName.chars=0;
BROWSEINFO FOdlg; memset(FOdlg, 0, sizeof(BROWSEINFO));
FOdlg.pszDisplayName = DirName.chars;
FOdlg.ulFlags = NULL;
long lpItem = SHBrowseForFolder(&FOdlg);
if(lpItem==0)
{
str_remove(DirName);
return(0);
}
else
{
SHGetPathFromIDList(lpItem, DirName.chars);
str_cpy(dir, DirName);
str_remove(DirName);
return(1);
}
}
How to use:
STRING* str_folder="";
folder_dialog(str_folder);
|
|
|
Re: Select Folder Dialog
[Re: gri]
#438667
03/19/14 20:13
03/19/14 20:13
|
Joined: Aug 2004
Posts: 1,305 New York
PrenceOfDarkness
Serious User
|
Serious User
Joined: Aug 2004
Posts: 1,305
New York
|
Man... How do you know how to do stuff like that? I find using anything windows related so over welming. Is there a programming magizine online out there Similar to aum??
Last edited by PrenceOfDarkness; 03/19/14 20:14.
"There is no problem that can't be solved with time and determination." -me prenceofdarkness for instant messages on AIM.
Looking for a model designer PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.
|
|
|
Re: Select Folder Dialog
[Re: PrenceOfDarkness]
#438671
03/19/14 21:07
03/19/14 21:07
|
Joined: Oct 2011
Posts: 1,082 Germany
Ch40zzC0d3r
Serious User
|
Serious User
Joined: Oct 2011
Posts: 1,082
Germany
|
Well theres something called google. Second result on google will get you this code, and implementing code form google is not a very hard task XD Ofcourse nobody knows ALL of the windows stuff. Just use google, it'll be fine
|
|
|
Re: Select Folder Dialog
[Re: Ch40zzC0d3r]
#438690
03/20/14 08:28
03/20/14 08:28
|
Joined: Aug 2002
Posts: 3,258 Mainz
oliver2s
OP
Expert
|
OP
Expert
Joined: Aug 2002
Posts: 3,258
Mainz
|
Well theres something called google. Second result on google will get you this code, and implementing code form google is not a very hard task XD Ofcourse nobody knows ALL of the windows stuff. Just use google, it'll be fine Yes, signed. Google + Windows API online manual = that's all
|
|
|
Re: Select Folder Dialog
[Re: sivan]
#438725
03/20/14 15:49
03/20/14 15:49
|
Joined: Oct 2004
Posts: 900 Lgh
rojart
User
|
User
Joined: Oct 2004
Posts: 900
Lgh
|
|
|
|
|