📄 jvqwindialogs.pas
字号:
{******************************************************************************}
{* WARNING: JEDI VCL To CLX Converter generated unit. *}
{* Manual modifications will be lost on next release. *}
{******************************************************************************}
{-----------------------------------------------------------------------------
The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/MPL-1.1.html
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for
the specific language governing rights and limitations under the License.
The Original Code is: JvWinDialogs.PAS, released on 2002-05-13.
The Initial Developer of the Original Code is Serhiy Perevoznyk.
All Rights Reserved.
Contributor(s):
Michael Beck
You may retrieve the latest version of this file at the Project JEDI's JVCL home page,
located at http://jvcl.sourceforge.net
Known Issues:
-----------------------------------------------------------------------------}
// $Id: JvQWinDialogs.pas,v 1.16 2004/09/07 23:11:36 asnepvangers Exp $
unit JvQWinDialogs;
{$I jvcl.inc}
{$I windowsonly.inc}
interface
uses
Qt, QWindows,
Windows, ShellAPI, ShlObj, ComObj, ActiveX, CommDlg, UrlMon,
SysUtils, Classes,
QGraphics, QControls, QForms, QDialogs,
JvQBaseDlg, JvQTypes, JvQComponent, JvQJCLUtils; // For OSCheck
{$HPPEMIT '#include "dbt.h"'}
type
HWND = Windows.HWND;
EShellOleError = class(Exception);
EWinDialogError = class(Exception);
TShellLinkInfo = record
PathName: string;
Arguments: string;
Description: string;
WorkingDirectory: string;
IconLocation: string;
IconIndex: Integer;
ShowCmd: Integer;
HotKey: Word;
end;
TSpecialFolderInfo = record
Name: string;
ID: Integer;
end;
const
OFN_EX_NOPLACESBAR = 1; // for new style of standard Windows dialogs
{$EXTERNALSYM OFN_EX_NOPLACESBAR}
SpecialFolders: array [0..29] of TSpecialFolderInfo = (
(Name: 'Alt Startup'; ID: CSIDL_ALTSTARTUP),
(Name: 'Application Data'; ID: CSIDL_APPDATA),
(Name: 'Recycle Bin'; ID: CSIDL_BITBUCKET),
(Name: 'Common Alt Startup'; ID: CSIDL_COMMON_ALTSTARTUP),
(Name: 'Common Desktop'; ID: CSIDL_COMMON_DESKTOPDIRECTORY),
(Name: 'Common Favorites'; ID: CSIDL_COMMON_FAVORITES),
(Name: 'Common Programs'; ID: CSIDL_COMMON_PROGRAMS),
(Name: 'Common Start Menu'; ID: CSIDL_COMMON_STARTMENU),
(Name: 'Common Startup'; ID: CSIDL_COMMON_STARTUP),
(Name: 'Controls'; ID: CSIDL_CONTROLS),
(Name: 'Cookies'; ID: CSIDL_COOKIES),
(Name: 'Desktop'; ID: CSIDL_DESKTOP),
(Name: 'Desktop Directory'; ID: CSIDL_DESKTOPDIRECTORY),
(Name: 'Drives'; ID: CSIDL_DRIVES),
(Name: 'Favorites'; ID: CSIDL_FAVORITES),
(Name: 'Fonts'; ID: CSIDL_FONTS),
(Name: 'History'; ID: CSIDL_HISTORY),
(Name: 'Internet'; ID: CSIDL_INTERNET),
(Name: 'Internet Cache'; ID: CSIDL_INTERNET_CACHE),
(Name: 'Network Neighborhood'; ID: CSIDL_NETHOOD),
(Name: 'Network Top'; ID: CSIDL_NETWORK),
(Name: 'Personal'; ID: CSIDL_PERSONAL),
(Name: 'Printers'; ID: CSIDL_PRINTERS),
(Name: 'Printer Links'; ID: CSIDL_PRINTHOOD),
(Name: 'Programs'; ID: CSIDL_PROGRAMS),
(Name: 'Recent Documents'; ID: CSIDL_RECENT),
(Name: 'Send To'; ID: CSIDL_SENDTO),
(Name: 'Start Menu'; ID: CSIDL_STARTMENU),
(Name: 'Startup'; ID: CSIDL_STARTUP),
(Name: 'Templates'; ID: CSIDL_TEMPLATES));
{SHObjectProperties Flags}
OPF_PRINTERNAME = $01;
OPF_PATHNAME = $02;
type
TOpenFileNameEx = packed record
lStructSize: DWORD; // Size of the structure in bytes.
hWndOwner: HWND; // Handle that is the parent of the dialog.
hInstance: HINST; // Application instance handle.
lpstrFilter: PAnsiChar; // String containing filter information.
lpstrCustomFilter: PAnsiChar; // Will hold the filter chosen by the user.
nMaxCustFilter: DWORD; // Size of lpstrCustomFilter, in bytes.
nFilterIndex: DWORD; // Index of the filter to be shown.
lpstrFile: PAnsiChar; // File name to start with (and retrieve).
nMaxFile: DWORD; // Size of lpstrFile, in bytes.
lpstrFileTitle: PAnsiChar; // File name without path will be returned.
nMaxFileTitle: DWORD; // Size of lpstrFileTitle, in bytes.
lpstrInitialDir: PAnsiChar; // Starting directory.
lpstrTitle: PAnsiChar; // Title of the open dialog.
Flags: DWORD; // Controls user selection Options.
nFileOffset: Word; // Offset of file name in filepath=lpstrFile.
nFileExtension: Word; // Offset of extension in filepath=lpstrFile.
lpstrDefExt: PAnsiChar; // Default extension if no extension typed.
lCustData: LPARAM; // Custom data to be passed to hook.
lpfnHook: function(Wnd: HWND; Msg: UINT; wParam: WPARAM;
lParam: LPARAM): UINT stdcall; // Hook.
lpTemplateName: PAnsiChar; // Template dialog, if applicable.
// Extended structure starts here.
pvReserved: Pointer; // Reserved, use nil.
dwReserved: DWORD; // Reserved, use 0.
FlagsEx: DWORD; // Extended Flags.
end;
TShellObjectType = (sdPathObject, sdPrinterObject);
TShellObjectTypes = set of TShellObjectType;
TJvFormatDriveKind = (ftQuick, ftStandard, ftBootable);
TJvDriveCapacity = (dcDefault, dcSize360kB, dcSize720kB);
TJvFormatDriveError = (errParams, errSysError, errAborted, errCannotFormat, errOther);
TJvFormatDriveErrorEvent = procedure(Sender: TObject; Error: TJvFormatDriveError) of object;
TJvFormatDriveDialog = class(TJvCommonDialogF)
private
FDrive: Char;
FFormatType: TJvFormatDriveKind;
FCapacity: TJvDriveCapacity;
FHandle: HWND;
FOnError: TJvFormatDriveErrorEvent;
procedure SetDrive(Value: Char);
protected
procedure DoError(ErrValue: Integer);
public
constructor Create(AOwner: TComponent); override;
function Execute: Boolean; override;
published
property Drive: Char read FDrive write SetDrive default 'A';
property FormatType: TJvFormatDriveKind read FFormatType write FFormatType;
property Capacity: TJvDriveCapacity read FCapacity write FCapacity;
property OnError: TJvFormatDriveErrorEvent read FOnError write FOnError;
end;
TJvOrganizeFavoritesDialog = class(TJvCommonDialog)
public
function Execute: Boolean; override;
end;
TJvCplInfo = record
Icon: TIcon;
Name: string;
Info: string;
lData: Longint;
end;
// the signature of procedures in CPL's that implements Control Panel functionality
TCplApplet = function(hwndCPl: HWND; uMsg: DWORD; lParam1, lParam2: Longint): Longint; stdcall;
TJvComputerNameDialog = class(TJvCommonDialog)
private
FComputerName: string;
FCaption: string;
public
constructor Create(AOwner: TComponent); override;
function Execute: Boolean; override;
property ComputerName: string read FComputerName;
published
property Caption: string read FCaption write FCaption;
end;
// (p3) could be removed - a more complete implementation is in JvBrowseFolder
TJvBrowseFolderDialog = class(TJvCommonDialog)
private
FFolderName: string;
FCaption: string;
public
constructor Create(AOwner: TComponent); override;
function Execute: Boolean; override;
property FolderName: string read FFolderName;
published
property Caption: string read FCaption write FCaption;
end;
TJvOutOfMemoryDialog = class(TJvCommonDialog)
private
FCaption: string;
public
function Execute: Boolean; override;
published
property Caption: string read FCaption write FCaption;
end;
// (rom) changed to new TJvCommonDialogF to get better Execute
TJvChangeIconDialog = class(TJvCommonDialogF)
private
FIconIndex: Integer;
FFileName: TFileName;
public
function Execute: Boolean; override;
published
property IconIndex: Integer read FIconIndex write FIconIndex;
property FileName: TFileName read FFileName write FFileName;
end;
TJvShellAboutDialog = class(TJvCommonDialog)
private
FCaption: string;
FIcon: TIcon;
FOtherText: string;
FProduct: string;
procedure SetIcon(NewValue: TIcon);
function StoreIcon: Boolean;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
public
function Execute: Boolean; override;
published
property Caption: string read FCaption write FCaption;
property Icon: TIcon read FIcon write SetIcon stored StoreIcon;
property OtherText: string read FOtherText write FOtherText;
property Product: string read FProduct write FProduct;
end;
TJvRunDialog = class(TJvCommonDialogP)
private
FCaption: string;
FDescription: string;
FIcon: TIcon;
procedure SetIcon(const Value: TIcon);
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Execute; override;
published
property Caption: string read FCaption write FCaption;
property Description: string read FDescription write FDescription;
property Icon: TIcon read FIcon write SetIcon;
end;
TJvObjectPropertiesDialog = class(TJvCommonDialogF)
private
FObjectName: TFileName;
FObjectType: TShellObjectType;
FInitialTab: string;
public
function Execute: Boolean; override;
published
property ObjectName: TFileName read FObjectName write FObjectName;
property ObjectType: TShellObjectType read FObjectType write FObjectType;
property InitialTab: string read FInitialTab write FInitialTab;
end;
TJvNewLinkDialog = class(TJvCommonDialogP)
private
FDestinationFolder: string;
public
procedure Execute; override;
published
property DestinationFolder: string read FDestinationFolder write FDestinationFolder;
end;
TJvAddHardwareDialog = class(TJvCommonDialogP)
public
procedure Execute; override;
end;
TJvOpenWithDialog = class(TJvCommonDialogP)
private
FFileName: TFileName;
public
procedure Execute; override;
published
property FileName: TFileName read FFileName write FFileName;
end;
TJvDiskFullDialog = class(TJvCommonDialogF)
private
FDriveChar: Char;
procedure SetDriveChar(Value: Char);
function GetDrive: UINT;
public
constructor Create(AOwner: TComponent); override;
function Execute: Boolean; override;
published
property DriveChar: Char read FDriveChar write SetDriveChar default 'C';
end;
TJvExitWindowsDialog = class(TJvCommonDialogP)
public
procedure Execute; override;
end;
TJvURLAssociationDialogOption = (uaDefaultName, uaRegisterAssoc);
TJvURLAssociationDialogOptions = set of TJvURLAssociationDialogOption;
TJvURLAssociationDialog = class(TJvCommonDialogF)
private
FURL: string;
FAssociatedApp: string;
FFileName: TFileName;
FOptions: TJvURLAssociationDialogOptions;
FDefaultProtocol: string;
FReturnValue: HRESULT;
function GetParentHandle: THandle;
public
// Returns false if user cancelled or if the user
// elected not to register the association. To find out if the user made
// a one-time choice, check the AssociatedApp property: if it is empty,
// the user cancelled
function Execute: Boolean; override;
constructor Create(AOwner: TComponent); override;
// After Execute, contains the path and filename to the associated application (if user didn't cancel)
property AssociatedApp: string read FAssociatedApp;
// Value returned by the function called by Execute.
// Possible return values:
// S_OK - content type succesfully associated with the extnesion
// S_FALSE - nothing was registered (f ex a one time registration)
property ReturnValue: HRESULT read FReturnValue;
published
// The file (type) to associate with the Protocol
// NB! FileName *must* contain an extension!
property FileName: TFileName read FFileName write FFileName;
// The URL with the protocol to assoiacte with FileName
// NB! if URL has no protocol (i.e "http://", "mailto:", "home-made:", etc),
// the function fails even before the dialog is displayed!
property URL: string read FURL write FURL;
// DefaultProtocol to prepend to URL if it doesn't have a protocol
property DefaultProtocol: string read FDefaultProtocol write FDefaultProtocol;
// Options for the dialog
property Options: TJvURLAssociationDialogOptions read FOptions write FOptions default [];
end;
TJvMIMEAssociationOption = (maRegisterAssoc);
TJvMIMEAssociationOptions = set of TJvMIMEAssociationOption;
TJvMIMEAssociationDialog = class(TJvCommonDialogF)
private
FContentType: string;
FAssociatedApp: string;
FFileName: TFileName;
FOptions: TJvMIMEAssociationOptions;
FReturnValue: HRESULT;
function GetParentHandle: THandle;
public
function Execute: Boolean; override;
// After Execute, contains the path and filename to the associated application (if user didn't cancel)
property AssociatedApp: string read FAssociatedApp;
// Value returned by the function called by Execute.
// Possible return values:
// S_OK - content type succesfully associated with the extnesion
// S_FALSE - nothing was registered
// E_ABORT - user cancelled
// E_FLAGS - invalid flag combination
// E_OUTOFMEMORY - out of memory
// E_POINTER - one of the input pointers are invalid
property ReturnValue: HRESULT read FReturnValue;
published
// The file (type) to associate with the Protocol
// NB! FileName *must* contain an extension!
property FileName: TFileName read FFileName write FFileName;
// The MIME contentype of FileName
property ContentType: string read FContentType write FContentType;
property Options: TJvMIMEAssociationOptions read FOptions write FOptions default [];
end;
const
SOFTDIST_FLAG_USAGE_EMAIL = $0001;
{$EXTERNALSYM SOFTDIST_FLAG_USAGE_EMAIL}
SOFTDIST_FLAG_USAGE_PRECACHE = $0002;
{$EXTERNALSYM SOFTDIST_FLAG_USAGE_PRECACHE}
SOFTDIST_FLAG_USAGE_AUTOINSTALL = $0003;
{$EXTERNALSYM SOFTDIST_FLAG_USAGE_AUTOINSTALL}
SOFTDIST_FLAG_DELETE_SUBSCRIPTION = $0004;
{$EXTERNALSYM SOFTDIST_FLAG_DELETE_SUBSCRIPTION}
type
_tagSOFTDISTINFO = packed record
cbSize: ULONG;
dwFlags: DWORD;
dwAdState: DWORD;
lpszTitle: LPWSTR;
lpszAbstract: LPWSTR;
lpszHREF: LPWSTR;
dwInstalledVersionMS: DWORD;
dwInstalledVersionLS: DWORD;
dwUpdateVersionMS: DWORD;
dwUpdateVersionLS: DWORD;
dwAdvertisedVersionMS: DWORD;
dwAdvertisedVersionLS: DWORD;
cbReserved: DWORD;
end;
{$EXTERNALSYM _tagSOFTDISTINFO}
{$EXTERNALSYM SOFTDISTINFO}
SOFTDISTINFO = _tagSOFTDISTINFO;
{$EXTERNALSYM SOFTDISTINFO}
LPSOFTDISTINFO = ^_tagSOFTDISTINFO;
{$EXTERNALSYM LPSOFTDISTINFO}
TSoftDistInfo = SOFTDISTINFO;
TJvSoftwareUpdateAdState = (asNone, asAvailable, asDownloaded, asInstalled);
TJvSoftwareUpdateFlags = (ufEmail, ufPreCache, ufAutoInstall, ufDeleteSubscription);
TJvSoftwareUpdateInfo = class(TPersistent)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -