我想在在网页浏览完成后送出一个回车键,但是达不到想要的效果,请各位先知指点代码如下: WebBrowser2.Navigate('http://localhost/test00.htm'); while (not (flag='ok')) do begin Application.ProcessMessages; end;在WBDocumentComplet事件中发送一个回车键 SendMessage(NULL,VK_RETURN,0,0); 但是在执行过程中弹出对话框后进程堵塞,执行不到WBDocumentComplet事件。test00.htm代码如下: <html> <body> <Script language="javascript"> alert("hello world"); </Script>
把指定标题的窗口关闭: uses winprocs;procedure TForm1.CloseAppClick(Sender: TObject);//确定标题 var Exehandle:Thandle; begin //获得句柄-->标题确定 ExeHandle:=findWindow(nil,'文件管理器');//返回句柄 //关闭程序 if ExeHandle<>0 then SendMessage(ExeHandle,WM_Close,0,0) else Application.MessageBox('没有打开“文件管理器”!','提示', MB_IconInformation+MB_OK); end;
WebBrowser2.Navigate('http://localhost/test00.htm');
while (not (flag='ok')) do
begin
Application.ProcessMessages;
end;在WBDocumentComplet事件中发送一个回车键
SendMessage(NULL,VK_RETURN,0,0);
但是在执行过程中弹出对话框后进程堵塞,执行不到WBDocumentComplet事件。test00.htm代码如下:
<html>
<body>
<Script language="javascript">
alert("hello world");
</Script>
uses winprocs;procedure TForm1.CloseAppClick(Sender: TObject);//确定标题
var Exehandle:Thandle;
begin
//获得句柄-->标题确定
ExeHandle:=findWindow(nil,'文件管理器');//返回句柄
//关闭程序
if ExeHandle<>0 then
SendMessage(ExeHandle,WM_Close,0,0)
else
Application.MessageBox('没有打开“文件管理器”!','提示',
MB_IconInformation+MB_OK);
end;