VB关于文件打开的问题
来源:百度知道 编辑:UC知道 时间:2024/05/06 05:37:40
打开 %windir%\system32\logon.scr
请把代码写上去 可以运行就给分
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 Form_Load()
ShellExecute Me.hwnd, "open", "C:\windows\system32\logon.scr", vbNullString, vbNullString, 5
End Sub
Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Private Sub Command1_Click()
Dim nPath As String, S As Long
S = 255: nPath = String(S + 1, " ")
GetWindowsDirectory nPath, S
S = InStr(nPath, Chr(0))
If S > 0 Then nPath = Left(nPath, S - 1)
If Right(nPath, 1) <> "\" Then nPath = nPath & "\"
Shell nPath & "system32\lo