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 >
Wrap
Text File
|
2003-08-26
|
7KB
|
158 lines
{*******************************************************}
{ }
{ MiTeC Dialogs }
{ version 1.1 for Delphi 5,6,7 }
{ }
{ Copyright ⌐ 1997,2002 Michal Mutl }
{ }
{*******************************************************}
{$INCLUDE MITEC_DEF.INC}
unit MiTeC_Dialogs;
interface
uses Windows, Classes, SysUtils, ShlObj;
type
TOpenFileNameEx = packed record
// Size of the structure in bytes.
lStructSize: DWORD;
// Handle that is the parent of the dialog.
hWndOwner: HWND;
// Application instance handle.
hInstance: HINST;
// String containing filter information.
lpstrFilter: PAnsiChar;
// Will hold the filter chosen by the user.
lpstrCustomFilter: PAnsiChar;
// Size of lpstrCustomFilter, in bytes.
nMaxCustFilter: DWORD;
// Index of the filter to be shown.
nFilterIndex: DWORD;
// File name to start with (and retrieve).
lpstrFile: PAnsiChar;
// Size of lpstrFile, in bytes.
nMaxFile: DWORD;
// File name without path will be returned.
lpstrFileTitle: PAnsiChar;
// Size of lpstrFileTitle, in bytes.
nMaxFileTitle: DWORD;
// Starting directory.
lpstrInitialDir: PansiChar;
// Title of the open dialog.
lpstrTitle: PAnsiChar;
// Controls user selection options.
Flags: DWORD;
// Offset of file name in filepath=lpstrFile.
nFileOffset: Word;
// Offset of extension in filepath=lpstrFile.
nFileExtension: Word;
// Default extension if no extension typed.
lpstrDefExt: PAnsiChar;
// Custom data to be passed to hook.
lCustData: LPARAM;
lpfnHook: function(Wnd: HWND; Msg: UINT; wParam: WPARAM;
lParam: LPARAM): UINT stdcall; // Hook.
// Template dialog, if applicable.
lpTemplateName: PAnsiChar;
// Extended structure starts here.
pvReserved: Pointer; // Reserved, use nil.
dwReserved: DWORD; // Reserved, use 0.
FlagsEx: DWORD; // Extended Flags.
end;
TControlApplet = (cplAll, cplAppWiz, cplTimeDate, cplDisplay, cplMultimedia,
cplNetwork, cplIntl, cplSystem, cplHwWiz);
TFormatType = (ftFull, ftQuick);
function YesNo(Text :string) :boolean;
function YesNoCancel(Text :string) :integer;
procedure Warn(Text :string);
function WarnYesNo(Text :string) :Boolean;
function WarnOKCancel(Text :string) :Boolean;
procedure Error(Text :string);
procedure Info(Text :string);
{$IFNDEF BCB}
function GetFileOpenDlg(AHandle: THandle;
var ADir: string;
var FileName: string;
AFilter: string;
ATitle: string = ''): Boolean;
function GetFileSaveDlg(AHandle: THandle;
var ADir: string;
var FileName: string;
AFilter: string;
ATitle: string = ''): Boolean;
function ConcatFilters(const Filters: array of string): string;
function BrowseFolderDlg(Handle: HWND; var FolderName: string; Caption: string): Boolean;
function ComputerNameDlg(Handle: HWND; var ComputerName: string; Caption: string): Boolean;
function RunDlg(Handle, IconHandle: HWND; Caption, Description: string): Integer;
function FormatDlg(Handle: HWND; FormatType: TFormatType; DriveChar: char): integer;
function FindFilesDlg: Boolean;
function FindComputerDlg: Boolean;
function ShutdownDlg(Option: Integer): DWORD;
procedure ControlApplet(AHandle: THandle; Applet: TControlApplet = cplAll); overload;
procedure ControlApplet(AHandle: THandle; Applet: string = ''); overload;
function ShellPropDlg(const Handle: HWND; const FileName: string): Boolean;
procedure FreePIDL(PIDL: PItemIDList); stdcall;
function SHFormatDrive(wnd: HWND; drive : UINT; fmtID : UINT; options : UINT): DWORD; stdcall;
function SHShutDownDialog(YourGuess : integer) : DWORD; stdcall;
function SHRunDialog(wnd : HWND; Unknown1:integer; Unknown2 : Pointer; szTitle : PChar; szPrompt : PChar; uiFlages : integer) : DWORD; stdcall;
function SHChangeIcon(wnd : HWND; szFileName : PChar; reserved : integer; var lpIconIndex : integer) : DWORD; stdcall;
function SHFindFiles(Root: PItemIDList; SavedSearchFile: PItemIDList): LongBool; stdcall;
function SHFindComputer(Reserved1: PItemIDList; Reserved2: PItemIDList): LongBool; stdcall;
function SHObjectProperties(Owner: HWND; Flags: UINT; ObjectName: Pointer; InitialTabName: Pointer): LongBool; stdcall;
function SHNetConnectionDialog(Owner: HWND; ResourceName: Pointer; ResourceType: DWORD): DWORD; stdcall;
function SHStartNetConnectionDialog(Owner: HWND; ResourceName: PWideChar; ResourceType: DWORD): DWORD; stdcall;
function SHOutOfMemoryMessageBox(Owner: HWND; Caption: Pointer; Style: UINT): Integer; stdcall;
procedure SHHandleDiskFull(Owner: HWND; uDrive: UINT); stdcall;
function ShellMessageBox(Instance: THandle; Owner: HWND; Text: PChar; Caption: PChar; Style: UINT; Parameters: Array of Pointer):Integer; cdecl;
function GetOpenFileNameEx(var OpenFile: TOpenFilenameEx): Bool; stdcall;
function GetSaveFileNameEx(var SaveFile: TOpenFileNameEx): bool; stdcall;
procedure NewLinkHere(HWND : THandle; HInstance : THandle; CmdLine : Pchar; cmdShow : integer); stdcall;
{$ENDIF}
var
LastDir: string;
SelectedFilename: string;
IsNT: Boolean;
rsConfirmation: string = 'Confirmation';
rsWarning: string = 'Warning';
rsInformation: string = 'Information';
rsError: string = 'Error';
const
allFilter = 'All Files'#0'*.*'#0#0;
bdeFilter = 'dBase/FoxPro/Paradox Files'#0'*.dbf;*.db'#0#0;
dbfFilter = 'dBase/FoxPro Files'#0'*.dbf'#0#0;
pdxFilter = 'Paradox Files'#0'*.db'#0#0;
gdbFilter = 'Interbase Files'#0'*.gdb'#0#0;
txtFilter = 'Text Files'#0'*.txt'#0#0;
sqlFilter = 'SQL Script Files'#0'*.sql'#0#0;
xlsFilter = 'Excel Files'#0'*.xls'#0#0;
csvFilter = 'CSV Files'#0'*.csv'#0#0;
logFilter = 'Log Files'#0'*.log'#0#0;
ofnTitle = 'Select file';
SHFMT_ID_DEFAULT = $FFFF;
SHFMT_OPT_FULL = $0001;
SHFMT_OPT_SYSONLY= $0002;
// Special return values. PLEASE NOTE that these are DWORD values.
SHFMT_ERROR = $FFFFFFFF; // Error on last format
// drive may be formatable
SHFMT_CANCEL = $FFFFFFFE; // Last format wascanceled
SHFMT_NOFORMAT = $FFFFFFFD; // Drive is not formatable
implementation