home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 February / Chip_2004-02_cd1.bin / zkuste / konfig / download / msic / Help / Int / MiTeC_Dialogs.int < prev    next >
Text File  |  2003-08-26  |  7KB  |  158 lines

  1. {*******************************************************}
  2. {                                                       }
  3. {               MiTeC Dialogs                           }
  4. {           version 1.1 for Delphi 5,6,7                }
  5. {                                                       }
  6. {       Copyright ⌐ 1997,2002 Michal Mutl               }
  7. {                                                       }
  8. {*******************************************************}
  9.  
  10. {$INCLUDE MITEC_DEF.INC}
  11.  
  12.  
  13. unit MiTeC_Dialogs;
  14.  
  15. interface
  16.  
  17. uses Windows, Classes, SysUtils, ShlObj;
  18.  
  19. type
  20.   TOpenFileNameEx = packed record
  21.    // Size of the structure in bytes.
  22.   lStructSize: DWORD;
  23.    // Handle that is the parent of the dialog.
  24.   hWndOwner: HWND;
  25.    // Application instance handle.
  26.   hInstance: HINST;
  27.    // String containing filter information.
  28.   lpstrFilter: PAnsiChar;
  29.    // Will hold the filter chosen by the user.
  30.   lpstrCustomFilter: PAnsiChar;
  31.    // Size of lpstrCustomFilter, in bytes.
  32.   nMaxCustFilter: DWORD;
  33.    // Index of the filter to be shown.
  34.   nFilterIndex: DWORD;
  35.    // File name to start with (and retrieve).
  36.   lpstrFile: PAnsiChar;
  37.    // Size of lpstrFile, in bytes.
  38.   nMaxFile: DWORD;
  39.    // File name without path will be returned.
  40.   lpstrFileTitle: PAnsiChar;
  41.    // Size of lpstrFileTitle, in bytes.
  42.   nMaxFileTitle: DWORD;
  43.    // Starting directory.
  44.   lpstrInitialDir: PansiChar;
  45.    // Title of the open dialog.
  46.   lpstrTitle: PAnsiChar;
  47.    // Controls user selection options.
  48.   Flags: DWORD;
  49.    // Offset of file name in filepath=lpstrFile.
  50.   nFileOffset: Word;
  51.    // Offset of extension in filepath=lpstrFile.
  52.   nFileExtension: Word;
  53.    // Default extension if no extension typed.
  54.   lpstrDefExt: PAnsiChar;
  55.    // Custom data to be passed to hook.
  56.   lCustData: LPARAM;
  57.   lpfnHook: function(Wnd: HWND; Msg: UINT; wParam: WPARAM;
  58.     lParam: LPARAM): UINT stdcall;  // Hook.
  59.    // Template dialog, if applicable.
  60.   lpTemplateName: PAnsiChar;
  61.    // Extended structure starts here.
  62.   pvReserved: Pointer;   // Reserved, use nil.
  63.   dwReserved: DWORD;     // Reserved, use 0.
  64.   FlagsEx: DWORD;        // Extended Flags.
  65.   end;
  66.  
  67.   TControlApplet = (cplAll, cplAppWiz, cplTimeDate, cplDisplay, cplMultimedia,
  68.                     cplNetwork, cplIntl, cplSystem, cplHwWiz);
  69.  
  70.   TFormatType = (ftFull, ftQuick);
  71.  
  72. function YesNo(Text :string) :boolean;
  73. function YesNoCancel(Text :string) :integer;
  74. procedure Warn(Text :string);
  75. function WarnYesNo(Text :string) :Boolean;
  76. function WarnOKCancel(Text :string) :Boolean;
  77. procedure Error(Text :string);
  78. procedure Info(Text :string);
  79.  
  80. {$IFNDEF BCB}
  81.  
  82. function GetFileOpenDlg(AHandle: THandle;
  83.                         var ADir: string;
  84.                         var FileName: string;
  85.                         AFilter: string;
  86.                         ATitle: string = ''): Boolean;
  87. function GetFileSaveDlg(AHandle: THandle;
  88.                         var ADir: string;
  89.                         var FileName: string;
  90.                         AFilter: string;
  91.                         ATitle: string = ''): Boolean;
  92. function ConcatFilters(const Filters: array of string): string;
  93. function BrowseFolderDlg(Handle: HWND; var FolderName: string; Caption: string): Boolean;
  94. function ComputerNameDlg(Handle: HWND; var ComputerName: string; Caption: string): Boolean;
  95. function RunDlg(Handle, IconHandle: HWND; Caption, Description: string): Integer;
  96. function FormatDlg(Handle: HWND; FormatType: TFormatType; DriveChar: char): integer;
  97. function FindFilesDlg: Boolean;
  98. function FindComputerDlg: Boolean;
  99. function ShutdownDlg(Option: Integer): DWORD;
  100. procedure ControlApplet(AHandle: THandle; Applet: TControlApplet = cplAll); overload;
  101. procedure ControlApplet(AHandle: THandle; Applet: string = ''); overload;
  102. function ShellPropDlg(const Handle: HWND; const FileName: string): Boolean;
  103.  
  104. procedure FreePIDL(PIDL: PItemIDList); stdcall;
  105. function  SHFormatDrive(wnd: HWND; drive : UINT; fmtID : UINT; options : UINT): DWORD; stdcall;
  106. function  SHShutDownDialog(YourGuess : integer) : DWORD; stdcall;
  107. function  SHRunDialog(wnd : HWND; Unknown1:integer; Unknown2 : Pointer; szTitle : PChar; szPrompt : PChar; uiFlages : integer) : DWORD; stdcall;
  108. function  SHChangeIcon(wnd : HWND; szFileName : PChar; reserved : integer; var lpIconIndex : integer) : DWORD; stdcall;
  109. function  SHFindFiles(Root: PItemIDList; SavedSearchFile: PItemIDList): LongBool; stdcall;
  110. function  SHFindComputer(Reserved1: PItemIDList; Reserved2: PItemIDList): LongBool; stdcall;
  111. function  SHObjectProperties(Owner: HWND; Flags: UINT; ObjectName: Pointer; InitialTabName: Pointer): LongBool; stdcall;
  112. function  SHNetConnectionDialog(Owner: HWND; ResourceName: Pointer; ResourceType: DWORD): DWORD; stdcall;
  113. function  SHStartNetConnectionDialog(Owner: HWND; ResourceName: PWideChar; ResourceType: DWORD): DWORD; stdcall;
  114. function  SHOutOfMemoryMessageBox(Owner: HWND; Caption: Pointer; Style: UINT): Integer; stdcall;
  115. procedure SHHandleDiskFull(Owner: HWND; uDrive: UINT); stdcall;
  116. function  ShellMessageBox(Instance: THandle; Owner: HWND; Text: PChar; Caption: PChar; Style: UINT; Parameters: Array of Pointer):Integer; cdecl;
  117. function  GetOpenFileNameEx(var OpenFile: TOpenFilenameEx): Bool; stdcall;
  118. function  GetSaveFileNameEx(var SaveFile: TOpenFileNameEx): bool; stdcall;
  119. procedure NewLinkHere(HWND : THandle; HInstance : THandle; CmdLine : Pchar; cmdShow : integer); stdcall;
  120.  
  121. {$ENDIF}
  122.  
  123. var
  124.   LastDir: string;
  125.   SelectedFilename: string;
  126.   IsNT: Boolean;
  127.  
  128.   rsConfirmation: string = 'Confirmation';
  129.   rsWarning: string = 'Warning';
  130.   rsInformation: string = 'Information';
  131.   rsError: string = 'Error';
  132.  
  133. const
  134.   allFilter = 'All Files'#0'*.*'#0#0;
  135.   bdeFilter = 'dBase/FoxPro/Paradox Files'#0'*.dbf;*.db'#0#0;
  136.   dbfFilter = 'dBase/FoxPro Files'#0'*.dbf'#0#0;
  137.   pdxFilter = 'Paradox Files'#0'*.db'#0#0;
  138.   gdbFilter = 'Interbase Files'#0'*.gdb'#0#0;
  139.   txtFilter = 'Text Files'#0'*.txt'#0#0;
  140.   sqlFilter = 'SQL Script Files'#0'*.sql'#0#0;
  141.   xlsFilter = 'Excel Files'#0'*.xls'#0#0;
  142.   csvFilter = 'CSV Files'#0'*.csv'#0#0;
  143.   logFilter = 'Log Files'#0'*.log'#0#0;
  144.  
  145.   ofnTitle = 'Select file';
  146.  
  147.   SHFMT_ID_DEFAULT = $FFFF;
  148.   SHFMT_OPT_FULL   = $0001;
  149.   SHFMT_OPT_SYSONLY= $0002;
  150.  // Special return values. PLEASE NOTE that these are DWORD values.
  151.   SHFMT_ERROR = $FFFFFFFF;  // Error on last format
  152.  // drive may be formatable
  153.   SHFMT_CANCEL = $FFFFFFFE;  // Last format wascanceled
  154.   SHFMT_NOFORMAT = $FFFFFFFD;  // Drive is not formatable
  155.  
  156. implementation
  157.  
  158.