Вниз
Скачать: 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 вся ветка

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.022 c
2-1179676353
BaseMaker
2007-05-20 19:52
2007.06.10
Не показывать удаленные поля!


3-1174627833
vajo
2007-03-23 08:30
2007.06.10
Как избавиться от запроса пароля на базу Access?


1-1176409968
illuha
2007-04-13 00:32
2007.06.10
Установка


15-1179133685
DIANA
2007-05-14 13:08
2007.06.10
нужна помощь! Двумерные массивы..


2-1179578772
AnSky
2007-05-19 16:46
2007.06.10
Сортировка в StringGrid




   Наверх