不需要用弹出窗口
var
Browser: IWebBrowser2;
Document: IHTMLDocument2;
Element: IHTMLElement;
with ActiveFormControl.ClientSite as IServiceProvider do
begin
OleCheck(QueryService(IWebbrowserApp,IWebbrowser2,Browser));
Document:=Browser.Document as IHTMLDocument2;
with Document.all do
begin
Str:=GUIDToString(CLASS_YOURACTIVEXFORM);
for i:=0 to length-1 do
begin
Element:=item(i,VarEmpty) as IHTMLElement;
if SameText(Element.tagName,'OBJECT') then
if SameText(Element.getAttribute('classid',0),
'CLSID:'+Copy(Str,2,StrLen(PChar(Str))-2)) then
break;
end;
end;
end;
//全屏
Browser.FullScreen:=True;
with Document.body do
begin
BodyScroll:=getAttribute('scroll',0)
//保存原始状态,还原时恢复
setAttribute('scroll','no',0);
end;
with Element do
begin
with Style do
begin
position:=getAttribute('position',0)
//保存原始状态,还原时恢复
zindex:=getAttribute('z-index',0);
visibility:=getAttribute('visibility',0);
left:=getAttribute('left',0);
top:=getAttribute('top',0);
width:=getAttribute('width',0);
height:=getAttribute('height',0);
setAttribute('position','absolute',0);
setAttribute('z-index','0',0);
setAttribute('visibility','visible',0);
setAttribute('left','0px',0);
setAttribute('top','0px',0);
setAttribute('width',InttoStr(Window.screen.width-1)+'px',0);
setAttribute('height',InttoStr(Window.screen.height-1)+'px',0);
end;
end;
//还原
Browser.FullScreen:=False;
Browser.ToolBar:=1;
with Element do
begin
with style do
begin
setAttribute('position',position,0);
setAttribute('z-index',zindex,0);
setAttribute('visibility',visibility,0);
setAttribute('left',left,0);
setAttribute('top',top,0);
setAttribute('width',width,0);
setAttribute('height',height,0);
end;
end;
with Document.body do
setAttribute('scroll',BodyScroll,0);