A:
program Generic;
(* Save this section as GENERIC.RC and
Compile to GENERIC.RES with the
Borland 32 bit Resource Command Line Compiler
(BRCC32.EXE) located in the Delphi 2.0 Bin Directory.
MAINICON ICON LOADONCALL MOVEABLE DISCARDABLE IMPURE
BEGIN
'00 00 01 00 01 00 20 40 10 00 00 00 00 00 E8 02'
'00 00 16 00 00 00 28 00 00 00 20 00 00 00 40 00'
'00 00 01 00 04 00 00 00 00 00 00 02 00 00 00 00'
'00 00 00 00 00 00 10 00 00 00 00 00 00 00 00 00'
'00 00 00 00 80 00 00 80 00 00 00 80 80 00 80 00'
'00 00 80 00 80 00 80 80 00 00 C0 C0 C0 00 80 80'
'80 00 00 00 FF 00 00 FF 00 00 00 FF FF 00 FF 00'
'00 00 FF 00 FF 00 FF FF 00 00 FF FF FF 00 00 08'
'F7 88 76 76 78 F7 88 60 F7 37 38 80 00 00 00 08'
'F7 88 67 67 68 F7 88 70 F7 37 38 80 00 00 00 08'
'F7 88 76 76 78 F7 88 60 F7 37 38 80 00 00 00 08'
'F7 88 67 67 68 F7 88 70 F7 37 38 80 00 00 00 08'
'F7 88 76 76 78 F7 88 60 F7 37 38 80 00 00 00 08'
'F7 88 67 67 68 F7 88 70 F7 37 38 80 00 00 88 88'
'88 88 88 88 88 88 88 80 F7 37 38 80 88 00 87 77'
'77 77 77 77 88 88 88 80 F7 37 38 80 78 00 88 88'
'88 88 88 88 88 88 88 80 F7 37 38 80 88 00 00 88'
'FF 77 77 77 77 77 77 70 F7 37 38 80 80 00 00 00'
'88 FF 78 88 88 88 88 80 F7 37 38 80 00 00 00 00'
'00 88 FF 78 87 77 78 80 F3 78 83 80 00 00 00 00'
'00 00 88 FF 78 77 87 0F 37 87 88 38 00 00 00 00'
'00 00 00 88 FF 88 70 F3 78 70 08 83 80 00 00 00'
'00 00 00 00 88 FF 0F 37 87 77 77 88 38 00 00 00'
'00 00 00 00 00 80 F3 78 73 03 03 08 78 80 00 00'
'00 00 00 00 00 80 37 87 00 00 00 00 88 30 00 00'
'00 00 00 00 00 00 00 01 11 11 11 11 11 00 00 00'
'00 00 00 00 00 00 00 99 B9 99 B9 99 99 00 00 00'
'00 00 00 00 00 00 00 99 B9 B9 9B B9 B9 00 00 00'
'00 00 00 00 00 00 09 9B B9 BB 99 BB 99 00 00 00'
'00 00 00 00 00 00 09 9B 99 9B 99 99 99 00 00 00'
'00 00 00 00 00 00 09 9B 9B 9B B9 BB 99 00 00 00'
'00 00 00 00 00 00 00 9B 9B 9B B9 99 90 00 00 00'
'00 00 00 00 00 00 00 9B 99 B9 BB 9B 00 00 00 00'
'00 00 00 00 00 00 00 09 99 B9 99 90 00 00 00 00'
'00 00 00 00 00 00 00 00 99 BB 99 90 00 00 00 00'
'00 00 00 00 00 00 00 00 09 99 B9 00 00 00 00 00'
'00 00 00 00 00 00 00 00 00 09 99 00 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 99 00 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 90 00 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 00 00 00 00 E0 00'
'00 0F E0 00 00 0F E0 00 00 0F E0 00 00 0F E0 00'
'00 0F E0 00 00 0F 00 00 00 03 00 00 00 03 00 00'
'00 03 C0 00 00 07 F0 00 00 0F FC 00 00 0F FF 00'
'00 07 FF C0 01 83 FF F0 00 01 FF FC 02 A0 FF FC'
'0F F0 FF FE 00 00 FF FF C0 03 FF FF C0 03 FF FF'
'80 03 FF FF 80 03 FF FF 80 03 FF FF C0 07 FF FF'
'C0 0F FF FF E0 1F FF FF F0 1F FF FF F8 3F FF FF'
'FE 3F FF FF FF 3F FF FF FF 7F FF FF FF FF'
END
GENERIC MENU
BEGIN
POPUP "&Help"
BEGIN
MENUITEM "&About Generic...", 100
END
END
ABOUTBOX DIALOG 10, 35, 144, 88
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About Generic"
FONT 8, "System"
BEGIN
CONTROL "&OK", 1, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE
| WS_TABSTOP, 53, 66, 38, 15
CONTROL "Generic Application", 102, "STATIC", SS_CENTER | WS_CHILD
| WS_VISIBLE, 35, 20, 75, 9
CONTROL "Delphi Demo", 103, "STATIC", SS_CENTER | WS_CHILD |
WS_VISIBLE, 30, 10, 85, 10
CONTROL "Copyright \251 1996", 104, "STATIC", SS_CENTER | WS_CHILD
| WS_VISIBLE, 35, 39, 71, 10
CONTROL "Borland International", 105, "STATIC", SS_CENTER |
WS_CHILD | WS_VISIBLE, 37, 49, 70, 10
END
*)
{$R GENERIC.RES}
uses Windows, Messages;
const
AppName = 'Generic';
const
idm_About = 100;
function About(Dialog: HWnd; Message: UINT; WPram: WPARAM;
LPram: LPARAM): LRESULT; stdcall; export;
begin
About := LRESULT(True);
case Message of
wm_InitDialog:
Exit;
wm_Command:
if (WPram = id_Ok) or (WPram = id_Cancel)
then
begin
EndDialog(Dialog, 1);
Exit;
end;
end;
About := LRESULT(False);
end;
function WindowProc(Window: Longint; Message: UINT; WPram: WPARAM;
LPram: LPARAM): LRESULT; stdcall; export;
var
AboutProc: TFarProc;
begin
WindowProc := 0;
case Message of
wm_Command:
if WPram = idm_About then
begin
AboutProc := MakeProcInstance(@About,
HInstance);
DialogBox(HInstance, 'AboutBox', Window,
AboutProc);
FreeProcInstance(AboutProc);
Exit;
end;
wm_Destroy:
begin
PostQuitMessage(0);
Exit;
end;
end;
WindowProc := DefWindowProc(Window, Message, WPram, LPram);
end;
procedure WinMain;
var
Window: HWND;
Message: TMsg;
WindowClass: TWndClass;
begin
WindowClass.style:= 0;
WindowClass.lpfnWndProc:= @WindowProc;
WindowClass.cbClsExtra:= 0;
WindowClass.cbWndExtra:= 0;
WindowClass.hIcon:= LoadIcon(HInstance, 'MAINICON');
WindowClass.hCursor:= LoadCursor(0, IDC_ARROW);
WindowClass.hbrBackground:= 0;
WindowClass.lpszMenuName:= AppName;
WindowClass.lpszClassName:= AppName;
WindowClass.hInstance := HInstance;
WindowClass.hbrBackground := GetStockObject(white_Brush);
RegisterClass(WindowClass);
Window := CreateWindow(
AppName,
'Delphi Generic',
ws_OverlappedWindow,
cw_UseDefault,
cw_UseDefault,
cw_UseDefault,
cw_UseDefault,
0,
0,
HInstance,
nil);
ShowWindow(Window, CmdShow);
UpdateWindow(Window);
while GetMessage(Message, 0, 0, 0) do
begin
TranslateMessage(Message);
DispatchMessage(Message);
end;
Halt(Message.wParam);
end;
begin
WinMain;
end.