Gamestudio Links
Zorro Links
Newest Posts
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
LPDIRECT3DCUBETEXTUR
E9

by Ayumi. 04/12/24 11:00
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
6 registered members (AndrewAMD, ricky_k, EternallyCurious, 7th_zorro, 2 invisible), 477 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Select Folder Dialog #435948
01/16/14 12:53
01/16/14 12:53
Joined: Aug 2002
Posts: 3,258
Mainz
oliver2s Offline OP
Expert
oliver2s  Offline 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

Code:
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:
Code:
STRING* str_folder="";
folder_dialog(str_folder);


Re: Select Folder Dialog [Re: oliver2s] #436018
01/17/14 07:30
01/17/14 07:30
Joined: Dec 2003
Posts: 1,225
germany
gri Offline
Serious User
gri  Offline
Serious User

Joined: Dec 2003
Posts: 1,225
germany
nice, thank you.


"Make a great game or kill it early" (Bruce Shelley, Ensemble Studios)
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 Offline
Serious User
PrenceOfDarkness  Offline
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
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

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 tongue

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 Offline OP
Expert
oliver2s  Offline OP
Expert

Joined: Aug 2002
Posts: 3,258
Mainz
Originally Posted By: Ch40zzC0d3r
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 tongue


Yes, signed. Google + Windows API online manual = that's all wink

Re: Select Folder Dialog [Re: oliver2s] #438694
03/20/14 08:35
03/20/14 08:35
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
+ many years programming experience grin


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: Select Folder Dialog [Re: sivan] #438725
03/20/14 15:49
03/20/14 15:49
Joined: Oct 2004
Posts: 900
Lgh
rojart Offline
User
rojart  Offline
User

Joined: Oct 2004
Posts: 900
Lgh
Really helpful, thanks.


Regards, Robert

Quote
Everything should be made as simple as possible, but not one bit simpler.
by Albert Einstein

PhysX Preview of Cloth, Fluid and Soft Body

A8.47.1P

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1