jeurk
asked on
shbrowseforfolder in my folder
Hi,
Herre follows my function that let's me
browse for a folder on the disk.
My problem is that I want to start the
browsing in a specified directory.
How can I add that ?
I don't want to browse ONLY starting
from that dir. I want to browse the whole
computer, but when the dialog opens I
want my folder to be already selected.
Working code would be nice.
Stay simple, I have the rxlib that comes
with a nice component that does all the
stuff. But it is doing too much. Maybe
we can do it by only adding one or two lines.
I know that we have to send a message
to the dialog with
procedure TBrowseFolderDlg.SetSelPat h(const Path: string);
begin
if FHandle <> 0 then
SendMessage(FHandle, BFFM_SETSELECTION, 1, Longint(PChar(Path)));
end;
But I don't know where to call it.
If you know how to do add the following
things :
-start browse with my dir selected
-enable the ok button only if a dir is
selected.
Thanks in advance.
-------------------------- -----
procedure TSelectFolder.Execute;
var
pMAlloc: IMalloc;
begin
wBrowseInfo.hwndOwner := TCustomForm(GetOwner).Hand le;
wBrowseInfo.pidlRoot := nil;
wBrowseInfo.pszDisplayName := wPath;
wBrowseInfo.lpszTitle := PChar('Tri2 Tool');
wBrowseInfo.ulFlags := 0;
wBrowseInfo.lpfn := nil;
wBrowseInfo.lParam := 0;
wBrowseInfo.iImage := 0;
try
CoGetMalloc(MEMCTX_TASK, pMAlloc);
GetMem(wPath, MAX_PATH);
wItemIDList := SHBrowseForFolder(wBrowseI nfo);
if wItemIDList <> nil then
if SHGetPathFromIDList(wItemI DList, wPath) then
FPath := wPath
else
FPath := ''
else
FPath := '';
finally
FreeMem(wPath);
pMalloc._Release;
end; // try
end;
Herre follows my function that let's me
browse for a folder on the disk.
My problem is that I want to start the
browsing in a specified directory.
How can I add that ?
I don't want to browse ONLY starting
from that dir. I want to browse the whole
computer, but when the dialog opens I
want my folder to be already selected.
Working code would be nice.
Stay simple, I have the rxlib that comes
with a nice component that does all the
stuff. But it is doing too much. Maybe
we can do it by only adding one or two lines.
I know that we have to send a message
to the dialog with
procedure TBrowseFolderDlg.SetSelPat
begin
if FHandle <> 0 then
SendMessage(FHandle, BFFM_SETSELECTION, 1, Longint(PChar(Path)));
end;
But I don't know where to call it.
If you know how to do add the following
things :
-start browse with my dir selected
-enable the ok button only if a dir is
selected.
Thanks in advance.
--------------------------
procedure TSelectFolder.Execute;
var
pMAlloc: IMalloc;
begin
wBrowseInfo.hwndOwner := TCustomForm(GetOwner).Hand
wBrowseInfo.pidlRoot := nil;
wBrowseInfo.pszDisplayName
wBrowseInfo.lpszTitle := PChar('Tri2 Tool');
wBrowseInfo.ulFlags := 0;
wBrowseInfo.lpfn := nil;
wBrowseInfo.lParam := 0;
wBrowseInfo.iImage := 0;
try
CoGetMalloc(MEMCTX_TASK, pMAlloc);
GetMem(wPath, MAX_PATH);
wItemIDList := SHBrowseForFolder(wBrowseI
if wItemIDList <> nil then
if SHGetPathFromIDList(wItemI
FPath := wPath
else
FPath := ''
else
FPath := '';
finally
FreeMem(wPath);
pMalloc._Release;
end; // try
end;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
whoops a bit slow :-)
ASKER
Hi,
works fine, just what I wanted. thanks.
inthe : I was aware of that componant
thanks. But i just wanted to add the
minimum code to do my stuff, thanks
anyway...
regards.
works fine, just what I wanted. thanks.
inthe : I was aware of that componant
thanks. But i just wanted to add the
minimum code to do my stuff, thanks
anyway...
regards.
ASKER
Inthe : happens everyday ;)
I missed some 1000 yesterday ;)
I missed some 1000 yesterday ;)
:-)))
yep i noticed :-)
dont worry it happens to us all
dont worry it happens to us all
http://www.delphifreestuff.com/cgi-bin/dfs_components.cgi?browsedr
might help some..