我找了个就是api的:CreateFile
但是我一引用就出现:用户类型未定义
但是我用:apiShellExecute
又没有问题,怎么回事呢?
代码如下:
Option Compare Database
'声明api函数
Private Declare Function apiShellExecute 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 Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, lpSecurityAttributes As SECURITY_ATTRIBUTES, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
Private Sub Command14_Click()
Dim file As String
file = "C:\Users\82500202\Desktop\111.txt"
Call CreateFile("D:\abc.txt", GENERIC_WRITE, 0, temp, CREATE_NEW, FILE_ATTRIBUTE_READONLY, 0)
Call apiShellExecute(hWndAccessApp, "Open", file, 0, 0, 1)
End Sub
|
Declare Function CreateFile Lib "kernel32" Alias
"CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal
dwShareMode As Long, lpSecurityAttributes As SECURITY_ATTRIBUTES, ByVal
dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal
hTemplateFile As Long) As Long
|