如果你是想要打开C:\123.txt文件
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_NORMAL = 1
Private Sub Command1_Click()
ShellExecute Me.hwnd, "open", C:\123.txt, vbNullString, vbNullString, 1 'c:\123.txt可以换成你想要打开的文件就行..什么格式的文件就自动用相应的程序打开了
End Sub
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
ShellExecute 0,"Open",<你的文件>,"","",1
=========================
这个代码不论是exe还是txt,只要在资源管理器中能显示有图标的文件都能打开
代码关键字好像是shell。
呵呵,不会是拿来使用在不良目的上啊?