Re: Get My Documents folder and Win Systems 9x....



"Rob Kennedy" <me3@xxxxxxxxxxx> wrote in message
news:3k0u2pFrqs7sU1@xxxxxxxxxxxxxxxxx
> didi wrote:
>> Hi, if someone need the function below it can freely use it..
>
> Please don't.
>
> Here's why.
>
> http://blogs.msdn.com/oldnewthing/archive/2003/11/03/55532.aspx
>

Thanks for the warning!

I have an old function to look up a foldername on the system:
--


function BrowseFolder(aRoot: integer; aCaption,Idir :string): string;
{
System browse for folder
------------------------
0 = All
1 = Internet explorer
2 = Programs
3 = Control panel
4 = Printers
5 = Mydocuments
6 = Favourites
7 = programs\Startup folder
8 = Recent files
9 = Sendto
10=Recycle bin
11=Start menu
}

var
pPrograms,pBrowse: PItemIDList;
hBrowseInfo: TBROWSEINFO;
hPChar: PChar;

begin
if (not SUCCEEDED(SHGetSpecialFolderLocation(Getactivewindow, aRoot,
pPrograms))) then
EXIT;
hPChar := StrAlloc(max_path);
with hBrowseInfo do
begin
hwndOwner := Getactivewindow;
pidlRoot := pPrograms;
pszDisplayName := hPChar;
lpszTitle := pChar(aCaption);
ulFlags := BIF_RETURNONLYFSDIRS;
lpfn := nil;
lParam := 0;
end;

pBrowse := SHBrowseForFolder(hBrowseInfo);
if (pBrowse <> nil) then
if (SHGetPathFromIDList(pBrowse, hPChar)) then Result:= hPChar else
Result:='';
StrDispose(hPChar);
end;
--

I wonder if SHBrowseForFolder will work correctly then. Or is there a better
way to look up a folder?


.



Relevant Pages

  • Re: Get My Documents folder and Win Systems 9x....
    ... {System browse for folder ... pPrograms))) then ... hPChar:= StrAlloc; ... Go ahead and declare the string parameters as const, ...
    (alt.comp.lang.borland-delphi)
  • Re: Saving settings and more
    ... if I nil then begin ... "Ove Antonsson" wrote in message ... > I think that in WINNT4 there is some other path to this folder ...
    (borland.public.delphi.ide)
  • Re: My Pictures folder says is empty but really its not - weird
    ... the recycle bin is empty and searches even for *.jpg etc come up nil. ... Abracadabra the pictures suddenly appear. ... If i use DOS and try the same I get no such folder even a DIR will get a nil result. ...
    (microsoft.public.windowsxp.general)