天天看點

VB程式設計:用Shell函數打開記事本

VB程式設計:用Shell函數打開記事本

Private Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long

Dim strtemp As String * 60

Private Sub Command1_Click()

   Dim L, S

   Dim paths As String

   L = GetSystemDirectory(strtemp, Len(strtemp))

   paths = Left(strtemp, L) & "\NOTEPAD.EXE"

   S = Shell(paths, vbNormalFocus)

End Sub