怎样让VB程序运行非EXE文件

来源:百度知道 编辑:UC知道 时间:2024/05/17 06:07:14
我想按Command1按钮 运行“c:\1.bmp”,就像在资源管理器里双击一样。。该怎么编,谢谢。

用ShellExecute函数

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 Sub Command1_Click()
ShellExecute 0&, vbNullString, "C:\1.BMP", vbNullString, vbNullString, vbNormalFocus
End Sub

改名字

简单的是有,不过要用API具体哪个我忘了,复杂的就是自己读取注册表进行操作