uses shellapi; h:HWND; rect:TRect; begin ShellExecute(Handle,'open','about:blank',nil,nil,SW_SHOWNORMAL); // Sleep(2000); h:=FindWindow('IEFrame',nil); if h<>Null then begin GetWindowRect(h,rect); MoveWindow(Self.Handle,rect.Right,rect.Top,Self.Width,Self.Height,True); ShowMessage(IntToStr(rect.Top)); end; end; xp上自己测试成功,楼主试试
h:HWND; rect:TRect; begin ShellExecute(Handle,'open','about:blank',nil,nil,SW_SHOWNORMAL); // Sleep(2000); h:=FindWindow('IEFrame',nil); if h<>Null then begin GetWindowRect(h,rect); MoveWindow(TheIEHandle,0,0,1024,700,true); ShowMessage(IntToStr(rect.Top)); end; end;
h:HWND;
rect:TRect;
begin
ShellExecute(Handle,'open','about:blank',nil,nil,SW_SHOWNORMAL);
// Sleep(2000);
h:=FindWindow('IEFrame',nil);
if h<>Null then begin
GetWindowRect(h,rect);
MoveWindow(Self.Handle,rect.Right,rect.Top,Self.Width,Self.Height,True);
ShowMessage(IntToStr(rect.Top));
end;
end;
xp上自己测试成功,楼主试试
参考
http://blog.csdn.net/laiyiling/archive/2004/11/21/189305.aspx
的代码没改将IE的窗口大小改成1024X700
引用 kriscn01 的代码,试试:MoveWindow(TheIEHandle,0,0,1024,700,true);
var
dde : TDdeClientConv;
bRet: Boolean;
begin
dde := TDdeClientConv.Create(self);
bRet:= dde.SetLink('Iexplore','WWW_GetWindowInfo'); if bRet then
Edit1.Text := dde.RequestData('0xFFFFFFFF, sURL, sTitle')
else
ShowMessage('没有打开IE');
dde.free;
end;
就是我用的是IE7支持多页面 每次点 他都会弹出个新的IE窗口 有办法让他都在1个IE里显示吗
rect:TRect;
begin
ShellExecute(Handle,'open','about:blank',nil,nil,SW_SHOWNORMAL);
// Sleep(2000);
h:=FindWindow('IEFrame',nil);
if h<>Null then begin
GetWindowRect(h,rect);
MoveWindow(TheIEHandle,0,0,1024,700,true);
ShowMessage(IntToStr(rect.Top));
end;
end;
ie: Variant;
begin
ie := CreateOleObject('InternetExplorer.Application');
//显示IE ie.visible := True; //显示163首页
ie.Navigate('http://www.163.com/');
//刷新页面 Sleep(1000*10);
ie.Refresh;
Sleep(20*1000);
//退出
ie.Quit;
ie := Unassigned;
end;
Twebbrowser