为了减小程序体积,我建了一个无窗体的程序(不用VCL),这个程序在后台运行,并定时进行一些操作(为减小体积使用winapi),但是这个程序一执行就退出了,能不能不让它退出?
我是菜鸟,希望大家可以说详细一点,谢谢,哈下面是源码
program Project1;uses
Windows,Messages;
procedure timerfun;stdcall; //定时执行程序
begin
winexec('c:\ppp.exe',sw_show);
end;begin
s:='c:\ppp.exe';
SetTimer(0,0,1000,@timerfun);
end.
我是菜鸟,希望大家可以说详细一点,谢谢,哈下面是源码
program Project1;uses
Windows,Messages;
procedure timerfun;stdcall; //定时执行程序
begin
winexec('c:\ppp.exe',sw_show);
end;begin
s:='c:\ppp.exe';
SetTimer(0,0,1000,@timerfun);
end.
Windows,Messages;
var
MSG:TMSG;procedure timerfun;stdcall; //定时执行程序
begin
winexec('c:\ppp.exe',sw_show);
end;begin
SetTimer(0,0,1000,@timerfun);
while(GetMessage(Msg,0,0,0))do
begin
TranslateMessage(Msg);
DispatchMessage(Msg);
end;
end.
http://www.vckbase.com/vckbase/function/viewfunc.asp?id=21