Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2003.11.13;
Скачать: CL | DM;

Вниз

Как вызвать стандартный диалог выбора папки?   Найти похожие ветки 

 
lipskiy ©   (2003-10-24 00:15) [0]

Не используя RX (D7)?


 
MBo ©   (2003-10-24 00:16) [1]

selectdirectory


 
Романов Р.В. ©   (2003-10-24 06:30) [2]

Модернизированный диалог открытия папки
const
BIF_NEWDIALOGSTYLE = $0040;

function BrCbProc(Wnd: HWND; uMsg: UINT; lParam, lpData: LPARAM): Integer stdcall;
const
_left = 60;
_top = 150;
var
R: TRect;
Path: array [0..MAX_PATH] of Char;
begin
Result := 0;
if uMsg = BFFM_INITIALIZED then
begin
GetWindowRect(Wnd, R);
SetWindowPos(Wnd, 0, _left, _top, R.Right - R.Left, R.Bottom - R.Top,
SWP_NOZORDER + SWP_NOACTIVATE);
end;
if (uMsg = BFFM_INITIALIZED) and (lpData <> 0) then
SendMessage(Wnd, BFFM_SETSELECTION, Integer(True), lpdata);
if uMsg = BFFM_SELCHANGED then
begin
if (lParam <> 0) then
begin
if SHGetPathFromIDList(PItemIDlist(lParam), Path) and DirectoryExists(Path) then
Windows.SendMessage(Wnd, BFFM_ENABLEOK, 0, 1)
else
Windows.SendMessage(Wnd, BFFM_ENABLEOK, 0, 0);
end
else
Windows.SendMessage(Wnd, BFFM_ENABLEOK, 0, 0);
end;

end;

function SelectDirectory(const Caption: string; const Root: WideString;
var Directory: string): Boolean;
var
WindowList: Pointer;
BrowseInfo: TBrowseInfo;
Buffer: PChar;
RootItemIDList, ItemIDList: PItemIDList;
ShellMalloc: IMalloc;
IDesktopFolder: IShellFolder;
Eaten, Flags: LongWord;
begin
Result := False;
FillChar(BrowseInfo, SizeOf(BrowseInfo), 0);
if (ShGetMalloc(ShellMalloc) = S_OK) and (ShellMalloc <> nil) then
begin
Buffer := ShellMalloc.Alloc(MAX_PATH);
try
RootItemIDList := nil;
if Root <> "" then
begin
SHGetDesktopFolder(IDesktopFolder);
IDesktopFolder.ParseDisplayName(Application.Handle, nil,
POleStr(Root), Eaten, RootItemIDList, Flags);
end;
with BrowseInfo do
begin
hwndOwner := Application.Handle;
pidlRoot := RootItemIDList;
pszDisplayName := Buffer;
lpszTitle := PChar(Caption);
ulFlags := BIF_RETURNONLYFSDIRS or BIF_NEWDIALOGSTYLE;
lpfn := BrCbProc;
lParam := Integer(PChar(Directory));
end;
WindowList := DisableTaskWindows(0);
try
ItemIDList := ShBrowseForFolder(BrowseInfo);
finally
EnableTaskWindows(WindowList);
end;
Result := ItemIDList <> nil;
if Result then
begin
ShGetPathFromIDList(ItemIDList, Buffer);
ShellMalloc.Free(ItemIDList);
Directory := Buffer;
end;
finally
ShellMalloc.Free(Buffer);
end;
end;
end;


 
LexXP ©   (2003-10-24 09:55) [3]

Примерно вот так


function BrowseFolder(Parent:hWnd=0): string;
var
lpItemID : PItemIDList;
BrowseInfo : TBrowseInfo;
DisplayName,TempPath : array[0..MAX_PATH-1] of char;
begin
FillChar(BrowseInfo, sizeof(TBrowseInfo),#0);
BrowseInfo.hwndOwner:=Parent;
BrowseInfo.pszDisplayName:=DisplayName;
BrowseInfo.lpszTitle:="


 
lipskiy ©   (2003-10-27 18:39) [4]

Всем спасибо!



Страницы: 1 вся ветка

Текущий архив: 2003.11.13;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.025 c
4-42274
bytebutcher
2003-09-12 13:52
2003.11.13
По каким признакам определить что окно отображается в TaskBare?


3-40810
NewD
2003-10-22 09:46
2003.11.13
Как подключиться через ADO к SQL SERVER на другой машине


7-42164
M@D
2003-09-01 22:53
2003.11.13
Shutdown XP


1-41167
lirjin
2003-11-01 09:40
2003.11.13
Общие вопросы


3-40824
denmin
2003-10-22 08:59
2003.11.13
Как передать параметр в ХП?