A abin30 Unregistered / Unconfirmed GUEST, unregistred user! 2009-05-25 #2 function SelectDirectory(handle: THandle;const Caption: string; const Root: WideString;out Directory: string): Boolean;var lpbi:_browseinfo; buf:array [0..MAX_PATH] of char; id:ishellfolder; eaten,att:cardinal; rtitemidlist; initdirwidechar;begin result:=false; lpbi.hwndOwner:=handle; lpbi.lpfn:=nil; lpbi.lpszTitle:=pchar(caption); lpbi.ulFlags:=BIF_RETURNONLYFSDIRS+64; SHGetDesktopFolder(id); initdir:=pwchar(root); id.ParseDisplayName(0,nil,initdir,eaten,rt,att); lpbi.pidlRoot:=rt; getmem(lpbi.pszDisplayName,MAX_PATH); try result:=shgetpathfromidlist(shbrowseforfolder(lpbi),buf); except freemem(lpbi.pszDisplayName); end; if result then directory:=buf;end;
function SelectDirectory(handle: THandle;const Caption: string; const Root: WideString;out Directory: string): Boolean;var lpbi:_browseinfo; buf:array [0..MAX_PATH] of char; id:ishellfolder; eaten,att:cardinal; rtitemidlist; initdirwidechar;begin result:=false; lpbi.hwndOwner:=handle; lpbi.lpfn:=nil; lpbi.lpszTitle:=pchar(caption); lpbi.ulFlags:=BIF_RETURNONLYFSDIRS+64; SHGetDesktopFolder(id); initdir:=pwchar(root); id.ParseDisplayName(0,nil,initdir,eaten,rt,att); lpbi.pidlRoot:=rt; getmem(lpbi.pszDisplayName,MAX_PATH); try result:=shgetpathfromidlist(shbrowseforfolder(lpbi),buf); except freemem(lpbi.pszDisplayName); end; if result then directory:=buf;end;
D delphi002 Unregistered / Unconfirmed GUEST, unregistred user! 2009-05-25 #3 to abin30你的只能选择目录吗?我既要选择目录,又要选择文件.
D de410 Unregistered / Unconfirmed GUEST, unregistred user! 2009-05-25 #4 将abin30的代码与Opendialog综合在一块不就实现了吗?