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

Вниз

Vista OpenSaveDialog   Найти похожие ветки 

 
Thaddy   (2006-10-20 16:02) [0]

Here"s another Vista thing:


function OpenSaveFileDialog(Parent: PControl; const DefExt, Filter, InitialDir, Title: string; var FileName: string;
 MustExist, OverwritePrompt, NoChangeDir, DoOpen: Boolean): Boolean;
var
 ofn: TOpenFileName;
 szFile: array[0..MAX_PATH] of Char;
 tmp: string;
begin
 Result := False;
 if Winver > WvXP then
 begin
   FillChar(ofn, SizeOf(TOpenFileName), 0);
   with ofn do
   begin
     lStructSize := SizeOf(TOpenFileName);
     hwndOwner := Parent.Handle;
     lpstrFile := szFile;
     nMaxFile := SizeOf(szFile);
     if (Title <> "") then
       lpstrTitle := PChar(Title);
     if (InitialDir <> "") then
       lpstrInitialDir := PChar(InitialDir);
     StrPCopy(lpstrFile, FileName);
     tmp := Filter;
     while strreplace(tmp, "|", #0) do
       ; //nothing but replace
     lpstrFilter := PChar(tmp + #0#0);
     if DefExt <> "" then
       lpstrDefExt := PChar(DefExt);
   end;

   if MustExist then
     ofn.Flags := ofn.Flags or OFN_FILEMUSTEXIST;

   if OverwritePrompt then
     ofn.Flags := ofn.Flags or OFN_OVERWRITEPROMPT;

   if NoChangeDir then
     ofn.Flags := ofn.Flags or OFN_NOCHANGEDIR;

   if DoOpen then
   begin
     if GetOpenFileName(ofn) then
     begin
       Result := True;
       FileName := szFile;
     end;
   end
   else
   begin
     if GetSaveFileName(ofn) then
     begin
       Result := True;
       FileName := szFile;
     end;
   end;
 end;
end;
</code


 
MTsv DN ©   (2006-10-21 09:25) [1]

> Here"s another Vista thing
Works fine :)

P.S. Only was error "Unknown identefier" in the line "ofn: TOpenFileName;"... I wrote "uses CommDlg"...and that"s all...
P.P.S. I don"t know why the definition "TOpenFileName" in KOL.PAS not determing...


 
Thaddy   (2006-10-23 10:25) [2]

Because kol.pas references commdlg for OpenSaveDialog :)



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

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

Наверх




Память: 0.47 MB
Время: 0.027 c
5-1155654550
DevilDevil
2006-08-15 19:09
2007.06.10
ДизайнТайм VS Рантайм


2-1179471546
Клара
2007-05-18 10:59
2007.06.10
Фильтрация


15-1179151025
Cyrax
2007-05-14 17:57
2007.06.10
Как, пользуясь правилами данного форума, определить судьбу...


15-1179152262
denis24
2007-05-14 18:17
2007.06.10
сохранение настроек IDE


15-1178961202
Пол
2007-05-12 13:13
2007.06.10
распределение нагрузки.