rt

解决方案 »

  1.   

    Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
    Public Const SW_SHOWNORMAL = 1
    ShellExecute Me.hwnd, vbNullString, "c:\1.html", vbNullString, "C:\", SW_SHOWNORMAL
    '*********************************************************************
      

  2.   

    用WebBrowser控件
    Me.WebBrowser1.Navigate "www.sohu.com", , , , ""
      

  3.   

    ShellExecute Me.hwnd, "open", "www.google.com", "", "", 1
      

  4.   

    ShellExecute Me.hwnd, "open", HTML文件路径, "", "", 1
      

  5.   

    谢谢我想要分Function openhtm(web, url, Optional usemode As String)
    '用到控件:webbrowser
    '调用:openhtm webbrowser1, "http://www.jiyi.org"
    If usemode = "" Then
    web.Navigate url
    ElseIf usemode = "webnew" Then
    web.Navigate url, , "_blank"
    ElseIf usemode = "iejs" Then
    web.Navigate "javascript:window.open('" & url & "')", , "_blank"
    End If
    End FunctionPrivate Sub Command1_Click()
    Dim url
    url = "http://www.jiyi.org"
    openhtm WebBrowser1, url, "webnew"
    End Sub
      

  6.   

    窗体源码:
    请另存为 web.frm
    VERSION 5.00
    Object = "{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}#1.1#0"; "shdocvw.dll"
    Begin VB.Form Form1 
       Caption         =   "Form1"
       ClientHeight    =   8535
       ClientLeft      =   60
       ClientTop       =   345
       ClientWidth     =   10275
       LinkTopic       =   "Form1"
       MaxButton       =   0   'False
       ScaleHeight     =   8535
       ScaleWidth      =   10275
       StartUpPosition =   2  '屏幕中心
       Begin VB.CommandButton Command1 
          Caption         =   "Command1"
          Height          =   975
          Left            =   3120
          TabIndex        =   1
          Top             =   360
          Width           =   4695
       End
       Begin SHDocVwCtl.WebBrowser WebBrowser1 
          Height          =   7455
          Left            =   1080
          TabIndex        =   0
          Top             =   1680
          Width           =   8535
          ExtentX         =   15055
          ExtentY         =   13150
          ViewMode        =   0
          Offline         =   0
          Silent          =   0
          RegisterAsBrowser=   0
          RegisterAsDropTarget=   1
          AutoArrange     =   0   'False
          NoClientEdge    =   0   'False
          AlignLeft       =   0   'False
          NoWebView       =   0   'False
          HideFileNames   =   0   'False
          SingleClick     =   0   'False
          SingleSelection =   0   'False
          NoFolders       =   0   'False
          Transparent     =   0   'False
          ViewID          =   "{0057D0E0-3573-11CF-AE69-08002B2E1262}"
          Location        =   ""
       End
    End
    Attribute VB_Name = "Form1"
    Attribute VB_GlobalNameSpace = False
    Attribute VB_Creatable = False
    Attribute VB_PredeclaredId = True
    Attribute VB_Exposed = False
    Function openhtm(web, url, Optional usemode As String)
    '用到控件:webbrowser
    '调用:openhtm webbrowser1, "http://www.jiyi.org"
    If usemode = "" Then
    web.Navigate url
    ElseIf usemode = "webnew" Then
    web.Navigate url, , "_blank"
    ElseIf usemode = "iejs" Then
    web.Navigate "javascript:window.open('" & url & "')", , "_blank"
    End If
    End FunctionPrivate Sub Command1_Click()
    Dim url
    url = "http://www.jiyi.org"
    openhtm WebBrowser1, url, "webnew"
    End Sub