Delphi - база знаний

         

Минимальное оконное приложение без VCL


Минимальное оконное приложение без VCL



program WinMin;

uses Windows, Messages;

const AppName = 'WinMin';

Var 
Window : HWnd;   
Message : TMsg;   
WindowClass : TWndClass;   



function WindowProc (Window : HWnd; Message, WParam : Word; LParam : LongInt) : LongInt; stdcall;
begin
WindowProc := 0;  
case Message of  
wm_Destroy :begin   
PostQuitMessage (0);   
Exit;   
end;  
end; // case  
WindowProc := DefWindowProc (Window, Message, WParam, LParam);   
end;

begin
with WindowClass do   
begin  
Style := cs_HRedraw or cs_VRedraw;   
lpfnWndProc := @WindowProc;   
cbClsExtra := 0;   
cbWndExtra := 0;   
hInstance := 0;   
hIcon := LoadIcon (0, idi_Application);  
hCursor := LoadCursor (0, idc_Arrow);   
hbrBackground := GetStockObject (White_Brush);   
lpszMenuName := '';   
lpszClassName := AppName;   
end;  
If RegisterClass (WindowClass) = 0 then Halt (255);   
Window := CreateWindow(AppName,   
'Win_Min',   
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   
end.

М. Краснов. "OpenGL и графика в проектах Delphi".

Пример прислан Spawn
Взято с Vingrad.ru



Содержание раздела