用个Timer1procedure TForm1.Button1Click(Sender: TObject); begin Timer1.Enabled:=True; Application.messagebox('hello world','提示',mb_ok or mb_iconinformation); end;procedure TForm1.Timer1Timer(Sender: TObject); var h:THandle; begin h:=FindWindow(nil,'提示'); if h<>0 then begin SendMessage(h,WM_CLOSE,0,0); end; Timer1.Enabled:=False; end;
1.放一个timer控件,设置时间建个为1秒procedure TForm1.btn1Click(Sender: TObject); begin tmr1.Enabled := True; Application.messagebox('hello world','提示',mb_ok or mb_iconinformation);end;procedure TForm1.tmr1Timer(Sender: TObject); var hMsgBox : THandle; dExitCode : Cardinal; begin hMsgBox := FindWindow(nil, '提示'); SendMessage(hMsgBox, WM_CLOSE, 0,0); tmr1.Enabled := False; end;
sleep(1000);
begin
Timer1.Enabled:=True;
Application.messagebox('hello world','提示',mb_ok or mb_iconinformation);
end;procedure TForm1.Timer1Timer(Sender: TObject);
var
h:THandle;
begin
h:=FindWindow(nil,'提示');
if h<>0 then
begin
SendMessage(h,WM_CLOSE,0,0);
end;
Timer1.Enabled:=False;
end;
begin
tmr1.Enabled := True;
Application.messagebox('hello world','提示',mb_ok or mb_iconinformation);end;procedure TForm1.tmr1Timer(Sender: TObject);
var
hMsgBox : THandle;
dExitCode : Cardinal;
begin
hMsgBox := FindWindow(nil, '提示');
SendMessage(hMsgBox, WM_CLOSE, 0,0);
tmr1.Enabled := False;
end;
去百度一下,Delphi 键盘
用Hook技术+多线程。
1秒后模拟按回车,就是了。
在新建一个窗体,让他随着程序启动时创建,然后把timer放到这个窗体上,执行关闭提示框的代码,这样就可以了
在新建一个窗体,让他随着程序启动时创建,然后把timer放到这个窗体上,执行关闭提示框的代码,这样就可以了
在新建一个窗体,让他随着程序启动时创建,然后把timer放到这个窗体上,执行关闭提示框的代码,这样就可以了
timer要在messagebox前enable