vb 将html文件加入exe并本程序中打开
展开全部
工具——》资源编辑器
工具条中倒数第二个,添加自定义资源
选择你的html文件
然后写如下代码:
Private 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
Private Const SW_SHOWNORMAL = 1
Private Sub Form_Load()
Dim a
a = LoadResData(101, "custom")
Open "a.html" For Binary As #1
Put #1, , a
Close
ShellExecute 0, "open", "a.html", "", "", SW_SHOWNORMAL
End Sub
Private Sub Form_Unload(Cancel As Integer)
Kill "a.html"
End Sub
运行窗体的时候将自动释放html文件并运行,关闭窗体时将删除html文件
工具条中倒数第二个,添加自定义资源
选择你的html文件
然后写如下代码:
Private 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
Private Const SW_SHOWNORMAL = 1
Private Sub Form_Load()
Dim a
a = LoadResData(101, "custom")
Open "a.html" For Binary As #1
Put #1, , a
Close
ShellExecute 0, "open", "a.html", "", "", SW_SHOWNORMAL
End Sub
Private Sub Form_Unload(Cancel As Integer)
Kill "a.html"
End Sub
运行窗体的时候将自动释放html文件并运行,关闭窗体时将删除html文件
追问
如何在WebBrowser中打开这个html呢??
追答
webbrowser直接输地址呗。。。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询