ironwit
Advanced Member | Редактировать | Профиль | Сообщение | ICQ | Цитировать | Сообщить модератору решил вот так var pidlInitialFolder: PItemIDList; rootpath:array [0..MAX_PATH] of WideChar; function BrowseCallbackProc( hWnd: HWND; uMsg: UINT; lParam: LPARAM; lpData: LPARAM ): Integer; stdcall; begin Result := 0; case uMsg of BFFM_INITIALIZED: begin PostMessage( hWnd, BFFM_SETSELECTION, 0, Integer(pidlInitialFolder) ); end; end; end; function tform1.opendirectory:string; var TitleName : string; lpItemID : PItemIDList; BrowseInfo : TBrowseInfo; DisplayName : array[0..MAX_PATH] of char; ppshf: IShellFolder; pchEaten: ULONG; dwAttributes: ULONG; TempPath: array[0..MAX_PATH]of char; s:string; begin FillChar(BrowseInfo, sizeof(TBrowseInfo), #0); BrowseInfo.hwndOwner := Form1.Handle; BrowseInfo.pszDisplayName := @DisplayName; TitleName := 'Title'; BrowseInfo.lpszTitle := PChar(TitleName); BrowseInfo.ulFlags := BIF_RETURNONLYFSDIRS; SHGetDesktopFolder(ppshf); ppshf.ParseDisplayName(application.handle,Nil,@rootpath,pchEaten,pidlInitialFolder,dwAttributes); BrowseInfo.lpfn := BrowseCallbackProc; lpItemID := SHBrowseForFolder(BrowseInfo); if lpItemId <> nil then begin SHGetPathFromIDList(lpItemID, temppath); if length(string(temppath))>0 then begin s:=temppath; StringToWideChar(s, @rootpath,length(s)+1); end; GlobalFreePtr(lpItemID); end else temppath:=''; result:=temppath; end; Может и кривовато но работает 
---------- Don't drink, and drive. Smoke and fly. |
|