关于WebBrowser焦点的问题?
关于WebBrowser焦点的问题?
楼主jie115(守望红木)2004-03-25 14:14:15 在 Delphi / VCL组件开发及应用 提问 很多帖子说WebBrowser容易失去焦点,我做了测试,发现的确如此。
我使用如下的代码:
procedure TWebOffice.SetFocusToDoc;
begin
if (WebBrowser <> nil) and (WebBrowser.Document <> nil) then
with (WebBrowser.Application as IOleobject) do
DoVerb(OLEIVERB_UIACTIVATE, nil, WebBrowser, 0, Handle, GetClientRect);
end;
可以是WebBrowser中的文档取得焦点,但是文档确不能编辑,就是说不能输入,很奇怪。! 问题点数:20、回复次数:3Top
1 楼along3000(抢分挤破了头)回复于 2004-03-25 15:11:23 得分 20
可以试试这两种方法:
1、
if WebBrowser1.Document <> nil then
IHTMLWindow2(IHTMLDocument2(WebBrowser1.Document).ParentWindow).focus
2、
if WebBrowser1.Document <> nil then
IHTMLWindow4(WebBrowser1.Document).focus
Top
2 楼jie115(守望红木)回复于 2004-03-25 15:52:58 得分 0
你好,我是用你给出的第二种方法,出现错误:
WebOfficeImpl.pas(677): Undeclared identifier: "focus"
WebOfficeProj.dpr(7): Could not compile used unit "WebOfficeImpl.pas"
我看了IHTMLWindow4的继承关系,好像都没有实现过focus这个方法啊。
而使用第一种方法测试,确出现不支持此接口的实时错误。
请指教。!!!!
Top
3 楼jie115(守望红木)回复于 2004-03-30 13:36:41 得分 0
谢谢,问题没有解决。
结贴Top
-
相关文章
2秒记住本站域名
玩过泡泡龙吗?Readygo?Go! 再加上.Com.Cn的后缀,那就是大名小顶的readygo.com.cn
