大小为15.0 KB (15,360 字节),但打到手软
program Project1;
uses
windows,messages;
var
hInst:THandle;
hWndMain:HWND;
function MainWndProc(hWn:HWND;message:UINT;wPar:WParam;lPar:LParam):LRESULT;stdcall;
const
s='hello world';
var
hdc1:HDC;
ps
AINTSTRUCT;
begin
Result:=0;
case (message) of
WM_PAINT:begin
hdc1:=BeginPaint(hwn,ps);
TextOut(hdc1,20,10,PChar(s),Length(s));
EndPaint(hwn,ps);
end;
WM_DESTROY:begin
PostQuitMessage(0);
end;
else begin
Result:=DefWindowProc(hwn,message,wpar,lpar);
end;
end;
end;
function Initapplication(hInstance:THandle):word;
var
wcSimpwin:TWndClass;
begin
with wcSimpwin do
begin
style:=0;
lpfnWndProc:=@MainWndProc;
cbClsExtra:=0;
cbWndExtra:=0;
hInstance:=hInstance;
hIcon:=LoadIcon(0,IDI_APPLICATION);
hCursor:=LoadCursor(0,IDC_ARROW);
hbrBackground:=GetStockObject(WHITE_BRUSH);
lpszMenuName:=0;
lpszClassName:='Simpwin WClass';
end;
result:=RegisterClass(wcSimpwin);
end;
function InitInstance(hInstance:THandle;nCmdShow:integer):boolean;
begin
hInst:=hInstance;
hWndMain:=CreateWindow('simpwin WClass',
'我的窗口',
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,CW_USEDEFAULT,
CW_USEDEFAULT,CW_USEDEFAULT,
0,0,hInstance,0);
if (hWndMain=0) then
begin
result:=false;
exit;
end;
ShowWindow(hWndMain,nCmdShow);
UpdateWindow(hWndMain);
result:=false;
end;
var
msg:TMsg;
begin
InitApplication(hInstance);
InitInstance(hInstance,SW_SHOW );
while GetMessage(msg,0,0,0) do
begin
TranslateMessage(msg);
DispatchMessage(msg);
end;
end.