请问:Web页面中怎么将消息发送给后台的delphi程序? 我用delphi做了个框架,其中用TWebBrowser控件嵌入了一些Web页面,想在Web页面中发送消息给delphi框架,请问怎样发送消息给后台框架? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 使用THTTPServer可接收页面请求。 还是在delphi中捕获webbrowser中的各种事件比较好些吧。估计你是想知道用户在干哪方面的事情。比如当用户点击某些部位等操作。就是把所有页面的事件重载到delphi程序中去。 盒子上有个例子,用HTML做程序界面。 HTM中的关键代码: <area shape="rect" coords="629,430,747,465" href="Email_" alt="发邮件" > <area shape="rect" coords="465,243,608,362" href="photo2_" alt="照片二" > <area shape="rect" coords="243,235,383,368" href="photo1_" alt="照片一" > <area shape="rect" coords="20,323,138,358" href="button4_" alt="按这里退出程序" > <area shape="rect" coords="20,267,138,302" href="button3_" alt="这是按钮三" > <area shape="rect" coords="24,217,142,252" href="button2_" alt="这是按钮二" > <area shape="rect" coords="24,166,142,201" href="button1_" alt="这是按钮一" > delphi中的关键代码: procedure TForm1.WebBrowser1BeforeNavigate2(Sender: TObject; const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData, Headers: OleVariant; var Cancel: WordBool); begin If Pos('button1_', URL)>0 Then Begin ShowMessage('你选择了按钮一!'); Cancel:=True; End; If Pos('button2_', URL)>0 Then Begin ShowMessage('你选择了按钮二!'); Cancel:=True; End; If Pos('button3_', URL)>0 Then Begin ShowMessage('你选择了按钮三!'); Cancel:=True; End; If Pos('button4_', URL)>0 Then close; If Pos('photo1_', URL)>0 Then Begin ShowMessage('你选择了图片一!'); Cancel:=True; End; If Pos('photo2_', URL)>0 Then Begin ShowMessage('你选择了图片二!'); Cancel:=True; End; If Pos('Email_', URL)>0 Then Begin ShowMessage('发邮件!'); Cancel:=True; End; end; 使用IE扩展 Protocols 协议。http://blog.sina.com.cn/s/blog_4ac69eaa0100055x.html http://download.csdn.net/user/adayuer 这里有个用 TWebBrowser 做界面的demo。你可以看看。 delphi 用ADOquery 删除 数据库中的字段 想弹框提示,但是我实习不了 关于telnet的问题,希望大家帮忙!!! 来看看这个 用delphi实现一个抽奖程序(急,解决立即给分,可以开贴加分) 如何模拟键盘的按键操作!!!!!!!!急,高分!!!! 关于窗体的分辨率的问题?进者有分! 汇编大大帮忙看下 分不多了 谢谢 我没有分了,只好重注册id! 各位大侠,我怎么用DELPHI自带的制作工具把目录也打进去?请教!!1 为什么没有返回sqlserver的数据? 为什么从数据库中取出WORD文件大小会改变? delphi中indy的idTCPServer问题,求助
HTM中的关键代码:
<area shape="rect" coords="629,430,747,465" href="Email_" alt="发邮件" >
<area shape="rect" coords="465,243,608,362" href="photo2_" alt="照片二" >
<area shape="rect" coords="243,235,383,368" href="photo1_" alt="照片一" >
<area shape="rect" coords="20,323,138,358" href="button4_" alt="按这里退出程序" >
<area shape="rect" coords="20,267,138,302" href="button3_" alt="这是按钮三" >
<area shape="rect" coords="24,217,142,252" href="button2_" alt="这是按钮二" >
<area shape="rect" coords="24,166,142,201" href="button1_" alt="这是按钮一" > delphi中的关键代码:
procedure TForm1.WebBrowser1BeforeNavigate2(Sender: TObject;
const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData,
Headers: OleVariant; var Cancel: WordBool);
begin
If Pos('button1_', URL)>0 Then
Begin
ShowMessage('你选择了按钮一!');
Cancel:=True;
End;
If Pos('button2_', URL)>0 Then
Begin
ShowMessage('你选择了按钮二!');
Cancel:=True;
End;
If Pos('button3_', URL)>0 Then
Begin
ShowMessage('你选择了按钮三!');
Cancel:=True;
End;
If Pos('button4_', URL)>0 Then close; If Pos('photo1_', URL)>0 Then
Begin
ShowMessage('你选择了图片一!');
Cancel:=True;
End;
If Pos('photo2_', URL)>0 Then
Begin
ShowMessage('你选择了图片二!');
Cancel:=True;
End;
If Pos('Email_', URL)>0 Then
Begin
ShowMessage('发邮件!');
Cancel:=True;
End;
end;