建议不是因为程序体积的话,还是用隐藏 Form 的办法简单,一切控件都可以用了。 在工程文件中加入 begin ...... application.showmainform:=false; ...... end; 在FORM1上放你需要的控件。 否则你要处理很多事件消息,比如: while GetMessage(msg, 0, 0, 0) do DispatchMessag(msg);
program Project1;uses Windows, messages;{$R *.RES}var msg: TMsg; hTimer: THandle; begin hTimer := SetTimer(0,0,2000,nil); While(GetMessage(msg,0,0,0)) do begin if msg.message = WM_TIMER then MessageBox(0,'','',MB_OK); end; KillTimer(0,hTimer); end.
在工程文件中加入
begin
......
application.showmainform:=false;
......
end;
在FORM1上放你需要的控件。
否则你要处理很多事件消息,比如:
while GetMessage(msg, 0, 0, 0) do
DispatchMessag(msg);
with TTimer.Create.....
何苦舍弃优秀的vcl模式,自己重新写代码呢?那岂不是和在用Turbo c++3一样了,什么都要自己完成。
Windows,
messages;{$R *.RES}var
msg: TMsg;
hTimer: THandle;
begin
hTimer := SetTimer(0,0,2000,nil);
While(GetMessage(msg,0,0,0)) do
begin
if msg.message = WM_TIMER then
MessageBox(0,'','',MB_OK);
end;
KillTimer(0,hTimer);
end.