I can't get past: CoInitialize(NIL);
Undeclared identifier.
Main Topics
Browse All TopicsHi,
I'm looking for a solid dialog component (or a way to adjust one like TOpenDialog) to be able to select a shellfolder from a list of available folders.
This solution must provide the functionality to create a new folder on the fly (including renaming of a folder).
Component must work under Delphi 7 and windows XP.
I prefer a free component, but all suggestions are appreciated.
Thank you for your help.
Stef
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
The JediVCL http://jvcl.sf.net contains JvBrowseForFolderDialog which should meet your needs.
This should do what you're wanting i think
uses ShlObj, ActiveX;
//global variables
var
Form4: TForm4
lg_StartFolder: String;
//functions
//no need to declare these anywhere at the top of the unit
function BrowseForFolderCallBack(Wn
begin
if uMsg = BFFM_INITIALIZED then
SendMessage(Wnd,BFFM_SETSE
result := 0;
end;
function BrowseForFolder(const browseTitle: String; const initialFolder: String =''): String;
var
browse_info: TBrowseInfo;
folder: array[0..MAX_PATH] of char;
find_context: PItemIDList;
begin
FillChar(browse_info, SizeOf(browse_info), #0);
lg_StartFolder := initialFolder;
browse_info.pszDisplayName
browse_info.lpszTitle := PChar(browseTitle);
browse_info.ulFlags := BIF_RETURNONLYFSDIRS or BIF_EDITBOX or $40;
browse_info.hwndOwner := Application.Handle;
if initialFolder <> '' then
browse_info.lpfn := BrowseForFolderCallBack;
find_context := SHBrowseForFolder(browse_i
if Assigned(find_context) then
begin
if SHGetPathFromIDList(find_c
result := folder
else
result := '';
GlobalFreePtr(find_context
end
else
result := '';
end;
//you can call it like so
procedure TForm4.Button3Click(Sender
begin
BrowseForFolder('Select Dir', 'C:\');
end;
hope this helps
HillGroover
Business Accounts
Answer for Membership
by: RadikalQ3Posted on 2005-08-31 at 02:59:00ID: 14792124
Hi!
: TObject); (BrowseInf o),#0);
fo);
Test if this is valid for your porpouses:
procedure TForm1.Button3Click(Sender
//uses ShlObj
var
BrowseInfo : TBrowseInfo;
PIDL : PItemIDList;
DisplayName : array[0..MAX_PATH] of Char;
begin
FillChar(BrowseInfo,SizeOf
BrowseInfo.hwndOwner := Handle;
BrowseInfo.pszDisplayName := @DisplayName[0];
BrowseInfo.lpszTitle := 'Select Directory';
BrowseInfo.ulFlags := BIF_RETURNONLYFSDIRS or BIF_EDITBOX or $40;
CoInitialize(NIL);
PIDL := SHBrowseForFolder(BrowseIn
if Assigned(PIDL) then
if SHGetPathFromIDList(PIDL, DisplayName) then
ShowMessage(DisplayName);
end;