写了一个win98下的例子,方法有点麻烦,不过能用:
program Project2;uses windows, messages, sysutils,registry;{$R *.RES}var hwndIEFirst : HWND;Function FindFirstIEWin( hwnd : HWND; lparam : LPARAM ) : BOOL; stdcall;
Var s : String;
len : Integer;
Begin
len := Length( String(lparam) ) + 150;
SetLength(s, len );
SendMessage( hwnd, WM_GETTEXT, len, Integer(PChar(s) ) ) ;
Result := Pos( String(lparam), s ) = 0;
If Not Result Then hwndIEFirst := hwnd;
End;Procedure PopupIEWindows( Const URL, WinName, IELayout : String );
Var si : TStartupInfo;
pi : TProcessInformation;
ie : String;
IEOpenCaption : String;Begin
With TRegistry.Create Do
Try
RootKey := HKEY_LOCAL_MACHINE;
OpenKey('\Software\Microsoft\IE Setup\SETUP',false );
ie := ReadString('Path' );
If ie = '' Then Raise Exception.Create( '没有安装IE!' );
ie := ie + '\iexplore.exe';
Finally
Free;
End;
hwndIEFirst := 0;
IEOpenCaption := 'javascript:open("'+ URL + '","' + WinName + '","' + IELayout + '")';
ie := ie + ' ' + IEOpenCaption;
FillChar( si, sizeof( TStartupInfo ), 0 );
With si Do
Begin
cb := sizeof( TStartupInfo );
dwFlags := STARTF_FORCEONFEEDBACK or STARTF_USESHOWWINDOW;
wShowWindow := SW_HIDE;
End;
If Not CreateProcess( nil,
PChar(ie),
nil, nil, false,
CREATE_NEW_PROCESS_GROUP or HIGH_PRIORITY_CLASS,
nil, nil, si, pi ) Then
Raise Exception.Create( '不能调用IE!' )
Else Begin
WaitForSingleObject( pi.hProcess, 1500 );
EnumThreadWindows( pi.dwThreadID, @FindFirstIEWin, LPARAM(PChar(IEOpenCaption)) );
If hwndIEFirst = 0 Then
Raise Exception.Create( '没有找到生成的第一个IE窗口!' ); SendMessage( hwndIEFirst, WM_SYSCOMMAND, SC_CLOSE, 0 );
End;
End;begin
PopupIEWindows( 'http://www.zei.gov.cn', '', 'resizable=no,width=200,height=200' );
end.
program Project2;uses windows, messages, sysutils,registry;{$R *.RES}var hwndIEFirst : HWND;Function FindFirstIEWin( hwnd : HWND; lparam : LPARAM ) : BOOL; stdcall;
Var s : String;
len : Integer;
Begin
len := Length( String(lparam) ) + 150;
SetLength(s, len );
SendMessage( hwnd, WM_GETTEXT, len, Integer(PChar(s) ) ) ;
Result := Pos( String(lparam), s ) = 0;
If Not Result Then hwndIEFirst := hwnd;
End;Procedure PopupIEWindows( Const URL, WinName, IELayout : String );
Var si : TStartupInfo;
pi : TProcessInformation;
ie : String;
IEOpenCaption : String;Begin
With TRegistry.Create Do
Try
RootKey := HKEY_LOCAL_MACHINE;
OpenKey('\Software\Microsoft\IE Setup\SETUP',false );
ie := ReadString('Path' );
If ie = '' Then Raise Exception.Create( '没有安装IE!' );
ie := ie + '\iexplore.exe';
Finally
Free;
End;
hwndIEFirst := 0;
IEOpenCaption := 'javascript:open("'+ URL + '","' + WinName + '","' + IELayout + '")';
ie := ie + ' ' + IEOpenCaption;
FillChar( si, sizeof( TStartupInfo ), 0 );
With si Do
Begin
cb := sizeof( TStartupInfo );
dwFlags := STARTF_FORCEONFEEDBACK or STARTF_USESHOWWINDOW;
wShowWindow := SW_HIDE;
End;
If Not CreateProcess( nil,
PChar(ie),
nil, nil, false,
CREATE_NEW_PROCESS_GROUP or HIGH_PRIORITY_CLASS,
nil, nil, si, pi ) Then
Raise Exception.Create( '不能调用IE!' )
Else Begin
WaitForSingleObject( pi.hProcess, 1500 );
EnumThreadWindows( pi.dwThreadID, @FindFirstIEWin, LPARAM(PChar(IEOpenCaption)) );
If hwndIEFirst = 0 Then
Raise Exception.Create( '没有找到生成的第一个IE窗口!' ); SendMessage( hwndIEFirst, WM_SYSCOMMAND, SC_CLOSE, 0 );
End;
End;begin
PopupIEWindows( 'http://www.zei.gov.cn', '', 'resizable=no,width=200,height=200' );
end.
解决方案 »
- stringgrid数值冒泡排序
- 伤心 散分.
- delphi搞得webservice连接数〉1000后的问题
- 要求与支持menggirl重新当斑竹!!!
- 討論:通過代理服務器(如SyGate等)上網的QQ是如何接收信息的?
- cannot focus a disable or invisible window
- .ceb 用什么打开?
- Delphi中如何获的其它应用程序中的内容?
- 对于我的大难题,谁能解决愿给100分。我在论坛信誉不差,可以去我以前的帖子。接受给分答不了的教训,所以先不下分。
- 显示?
- 我问的如何在DBGrid表格控件中为表格添加色带的问题,即第一行为灰色,第二行为白色,第三行为灰色,第四行为白色,依次类推,只能在Delphi自带的数据库中实现,
- 求助:DBLOOKUPCOMBOBOX的问题
program Project1;uses
Forms, Shdocvw;{$R *.RES}begin
Application.Initialize;
With CoInternetExplorer.Create Do
Begin
Resizable := False;
StatusBar := False;
ToolBar := 0;
top := 100;
Left := 100;
Height := 300;
Width := 200;
AddressBar := False;
Visible := true;
Navigate( 'http://www.ziq.gov.cn', EmptyParam, EmptyParam, EmptyParam, EmptyParam );
End;
end.