Главная страница
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.029 c
1-41370
SiJack
2003-10-30 16:14
2003.11.13
Плз помогите. Делаю отчет в word2000 (win98SE) все работает норма


1-41431
REA
2003-10-28 17:20
2003.11.13
Array of Const


9-40780
_0$a_
2003-05-06 22:42
2003.11.13
помогите Советом


3-41013
denmin
2003-10-14 11:02
2003.11.13
Как настроить клиента для MS SQL 2000?


3-40938
@lex
2003-10-17 11:06
2003.11.13
Кто-нибудь пробовал запустить скрипт describe в Delphi