Код:
[Code]
#define A = (Defined UNICODE) ? "W" : "A"
#ifndef IS_ENHANCED
const
WC_HEADER = 'SysHeader32';
WS_CHILD = $40000000;
WS_VISIBLE = $10000000;
WS_DISABLED = $08000000;
WM_SETFONT = $0030;
HDI_WIDTH = $0001;
HDI_TEXT = $0002;
HDI_FORMAT = $0004;
HDF_CENTER = $0002;
HDF_STRING = $4000;
HDM_FIRST = $1200;
HDM_INSERTITEM = HDM_FIRST + {#ifdef UNICODE}10{#else}1{#endif};
type
THDItem = record
Mask: LongWord;
cxy: Integer;
pszText: string;
hbm: HBITMAP;
cchTextMax: Integer;
fmt: Integer;
lParam: LongWord;
iImage: Integer;
iOrder: Integer;
_type: LongWord;
pvFilter: LongWord;
state: LongWord;
end;
// Window Functions
function CreateWindowEx(dwExStyle: DWORD; lpClassName, lpWindowName: string; dwStyle: DWORD; x, y, nWidth, nHeight: Integer; hWndParent: HWND; hMenu: THandle; hInstance, lpParam: Longint): HWND; external 'CreateWindowEx{#A}@user32.dll stdcall';
function DestroyWindow(hWnd: HWND): BOOL; external 'DestroyWindow@user32.dll stdcall';
// Message Functions
function SendMessageHDItem(hWnd: HWND; Msg: LongWord; wParam: Longint; var lParam: THDItem): Longint; external 'SendMessage{#A}@user32.dll stdcall';
var
HeaderHandle: HWND;
#endif
procedure CreateHeader;
var
#ifdef IS_ENHANCED
HeaderControl: THeaderControl;
HeaderSection: THeaderSection;
#else
HDItem: THDItem;
#endif
begin
with WizardForm.ComponentsList do
begin
#ifdef IS_ENHANCED
HeaderControl := THeaderControl.Create(WizardForm);
HeaderControl.Parent := WizardForm.ComponentsList;
HeaderControl.Enabled := False;
HeaderSection := HeaderControl.Sections.Add;
HeaderSection.Width := ClientWidth div 3;
HeaderSection.Alignment := taCenter;
HeaderSection.Text := '';
HeaderSection := HeaderControl.Sections.Add;
HeaderSection.Width := ClientWidth div 3;
HeaderSection.Alignment := taCenter;
HeaderSection.Text := 'Компоненты';
HeaderSection := HeaderControl.Sections.Add;
HeaderSection.Width := ClientWidth div 3;
HeaderSection.Alignment := taCenter;
HeaderSection.Text := 'Размер компонента';
#else
HeaderHandle := CreateWindowEx(0, WC_HEADER, '', WS_VISIBLE or WS_CHILD or WS_DISABLED, 0, 0, ClientWidth, MinItemHeight, Handle, 0, 0, 0);
if HeaderHandle = 0 then Exit;
SendMessage(HeaderHandle, WM_SETFONT, Font.Handle, 1);
HDItem.Mask := HDI_WIDTH or HDI_TEXT or HDI_FORMAT;
HDItem.cxy := ClientWidth div 3;
HDItem.fmt := HDF_CENTER or HDF_STRING;
HDItem.pszText := '';
SendMessageHDItem(HeaderHandle, HDM_INSERTITEM, 0, HDItem);
HDItem.pszText := 'Компоненты';
SendMessageHDItem(HeaderHandle, HDM_INSERTITEM, 1, HDItem);
HDItem.pszText := 'Размер компонента';
SendMessageHDItem(HeaderHandle, HDM_INSERTITEM, 2, HDItem);
#endif
end;
end;
procedure InitializeWizard;
begin
CreateHeader;
end;
procedure DeinitializeSetup;
begin
#ifndef IS_ENHANCED
if HeaderHandle <> 0 then
DestroyWindow(HeaderHandle);
#endif
end;