⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.dpr

📁 用API写WINDOWS窗体!
💻 DPR
字号:
program small;
uses
windows,messages,sysutils;
var
wclass:twndclass;
msg:tmsg;
hinst,handle,hfont:integer;

procedure exit;
begin
deleteobject(hfont);
unregisterclass(wclass.lpszclassname,hinst);
exitprocess(hinst);
end;

function windowproc(hwnd,msg,wparam,lparam:integer):longint;stdcall;
begin
result:=defwindowproc(hwnd,msg,wparam,lparam);
case msg of
wm_destroy:exit;
end;
end;

function createmain(name:pchar;x1,y1,x2,y2:integer):hwnd;
begin
hinst:=getmodulehandle(nil);
with wclass do
begin
style:=cs_parentdc;
hicon:=loadicon(hinst,'mainicon');
lpfnwndproc:=@windowproc;
hinstance:=hinst;
hbrbackground:=color_btnface+1;
lpszclassname:='mainclass';
hcursor:=loadcursor(0,idc_arrow);
end;
registerclass(wclass);
result:=createwindow(wclass.lpszclassname,name,ws_overlappedwindow or ws_visible,x1,y1,x2,y2,0,0,hinst,nil);
end;

begin
handle:=createmain('mainform',0,0,384,140);
while (getmessage(msg,handle,0,0)) do
begin
translatemessage(msg);
dispatchmessage(msg);
end;
end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -