在webbrowser里按回画没有反应,
很郁闷的一件事,有谁知道怎么解决?
让它能跟正常的IE一样工作。
很郁闷的一件事,有谁知道怎么解决?
让它能跟正常的IE一样工作。
解决方案 »
- KOL的tkolimageshow的bug?
- 做一个数据库比较的工具,大家帮忙来看看
- 元旦将至,祝大家新年快乐
- 大家找女朋友的标准是什么?明天要见网上女友,这是mail
- 用过dxdbgrid的朋友请进!!急!!!
- 请问我已经结帖的上半年的帖子怎么没有了???我到哪才能找到???
- 如何去掉WebBrowser嵌入的工具栏
- delphi用fastreport报表打印条码,如何改变条码颜色,或者改变条码透名度,求大神解决!
- 怎样用QReport做动态报表?
- 如何取得文件“属性"页中的相关信息?
- 高手请进!!!!!!!!!!!
- 如何在dxDBGrid或是wwDBGrid中将某个字段相同的值合并显示为一个单元格?
Problem: Web forms that have multi-line text boxes and/or Submit buttons do not
respond to the Enter key when displayed on a TWebbrowser.
Also when browsing local folders, some keys don't respond. How to solve it:
} unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, ActiveX, StdCtrls, SHDocVw;type
TForm1 = class(TForm)
WebBrowser1: TWebBrowser;
Button1: TButton;
procedure FormDestroy(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
FOleInPlaceActiveObject: IOleInPlaceActiveObject;
procedure MsgHandler(var Msg: TMsg; var Handled: Boolean);
public
{ Public declarations }
end; var
Form1: TForm1;
implementation {$R *.dfm} procedure TForm1.FormDestroy(Sender: TObject);
begin
FOleInPlaceActiveObject := nil;
end;procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnMessage := MsgHandler;
WebBrowser1.Navigate('www.google.com');
end; procedure TForm1.MsgHandler(var Msg: TMsg; var Handled: Boolean);
const
DialogKeys: set of Byte = [VK_LEFT, VK_RIGHT, VK_BACK, $30..$39, $41..$5A];
var
iOIPAO: IOleInPlaceActiveObject;
Dispatch: IDispatch;
begin
{ exit if we don't get back a webbrowser object }
if (WebBrowser1 = nil) then
begin
Handled := System.False;
Exit;
end; Handled := (IsDialogMessage(WebBrowser1.Handle, Msg) = System.True); if (Handled) and (not WebBrowser1.Busy) then
begin
if FOleInPlaceActiveObject = nil then
begin
Dispatch := WebBrowser1.Application;
if Dispatch <> nil then
begin
Dispatch.QueryInterface(IOleInPlaceActiveObject, iOIPAO);
if iOIPAO <> nil then
FOleInPlaceActiveObject := iOIPAO;
end;
end; if FOleInPlaceActiveObject <> nil then
if ((Msg.message = WM_KEYDOWN) or (Msg.message = WM_KEYUP)) and
(Msg.wParam in DialogKeys) then
// nothing - do not pass on the DialogKeys
else
FOleInPlaceActiveObject.TranslateAccelerator(Msg);
end;
end;end.