热情软件屋

 

如何使用ShellExecute在新的窗口中打开新的网站


编号:QA002489
建立日期: 2000年1月27日 最后修改日期:2000年2月16日
所属类别:

xuzhiyong:
    操作系统:Win95/98
    编程工具:VB 5.0
    问题:应用ShellExecute可以把开一个网站,但同时亦会覆盖掉现有的网站内容,请问如何使用ShellExecute在新的窗口中打开新的网站?

回答:

    chen的意见:
    打开VB菜单的 Project|References 项,在References对话框中有一个Microsoft Internet Control项,选中它,然后在Form1中加入一个CommandButton,在Form1中加入一下代码:
    'Dim dWinFolder As ShellLinkObject
    Dim dWinFolder As ShellWindows
    
    Private Sub Command1_Click()
     bBrowser = False
     If dWinFolder.Count = 0 Then
     '没有打开的浏览器窗口,执行常规的ShellExecute 打开网页
     Else
     dWinFolder.Item(0).Navigate "file:///c:/windows/temp/a.htm", navOpenInNewWindow, _
     "_blank", 0, 0
     End If
    End Sub
    
    Private Sub Form_Load()
     Set dWinFolder = New ShellWindows
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
     Set dWinFolder = Nothing
    End Sub
    运行程序,就可以在新窗口中打开了。ShellWindows对象是Windows下运行的所有外壳浏览器的集合。
    欢迎到我的VB站点 http://www.applevb.com
    
    Dean Liu的意见:
    用CreateProcess "C:\Program Files\Internet Explorer\Iexplore.exe " YourURL

此问题由chen等回答。

附加关键字:编程, 源程序, programming, source code, Visual Basic, VB, Internet编程, INET, www, internet, ie, ActiveX技术, activex, com, ado

 
把这个问题推荐给朋友
   
   
您的意见类别
您的名字
您的电子邮件
您的建议(请尽可能详细)
 
 

版权所有 1997-2008 热情软件屋
如果您有任何建议和意见, 请给我发个电子邮件 askpro@china-askpro.com
Web Designed by ZebraStudio