Вниз
Скачать: 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.44 MB
Время: 0.022 c
2-1179409650
Тимоха
2007-05-17 17:47
2007.06.10
цвет в итеме


2-1179579674
dfsfd
2007-05-19 17:01
2007.06.10
Path


2-1179666604
hamster
2007-05-20 17:10
2007.06.10
Нажать control


2-1178640857
Санёк77
2007-05-08 20:14
2007.06.10
Помогите, пожалуйста, разобраться!


15-1179385137
Kerk
2007-05-17 10:58
2007.06.10
Oracle External Procedure на Delphi




   Наверх