[ Home | Contents | Search | Next | Previous | Up ]
Date: 11/30/99
Time: 12:21:07 AM
Q. Is anybody out there who can help me using the BrowsForFolder Function? Do you know an example?
A. Here is an example for your BrowsForFolderproblems. I donīt really
know if you need the CoIninitialize function. this is an windows api function. it is
needed for some of the TShellItem functions (such as copy). just make a TShellItem with a
starting path ("c:\\win95") or one of the TShellItem constants such as
MyComputer:
CoInitialize(0);
TShellItem item(TShellItem::MyComputer);
TCreateStruct cs;
if(item.BrowseForFolder(cs)==IDOK){
TShellItem item2(cs);
char t[2000];
strcpy(t,item2.GetPath());
...
// your code here
}
CoUninitialize();
BrowseForFolder stores item information in TCreateStruct to initialize an new
item ("item2"). from this you get the desired path. the initializationpath of
item must be a folder or one of the constanst. if you are using borland c 5.01 you need to
bind except.rc manually. youīll find it in some of the borland dirs. but !WARNING! there
is a very interesting bug in the folder function. pushing "ok" when
"Arbeitsplatz" (donīt know the english version) is selected you īll get an
exeption of the shell. if you find out how to survive this please report. normally the ok
button is not highlighted when beeing on "Arbeitsplatz".
Enjoy.
-Erik