📄 module2.bas
字号:
Attribute VB_Name = "Module2"
Option Explicit
Private Const INFINITE = &HFFFF ' Infinite timeout
Private Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
Private Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessId As Long
dwThreadId As Long
End Type
Private Type SECURITY_ATTRIBUTES
nLength As Long
lpSecurityDescriptor As Long
bInheritHandle As Long
End Type
Private Declare Function CreateProcess Lib "kernel32" Alias "CreateProcessA" (ByVal lpApplicationName As String, ByVal lpCommandLine As String, lpProcessAttributes As SECURITY_ATTRIBUTES, lpThreadAttributes As SECURITY_ATTRIBUTES, ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, lpEnvironment As Any, ByVal lpCurrentDriectory As String, lpStartupInfo As STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Public Sub myrun(commandstring As String)
Dim resultat As Long
Dim resultat2 As Long
Dim res As Double
Dim startinfo As STARTUPINFO
Dim procnfo As PROCESS_INFORMATION
Dim secu As SECURITY_ATTRIBUTES
Dim lc As Long
startinfo.cb = Len(startinfo)
secu.nLength = Len(secu)
resultat = CreateProcess(commandstring, "", secu, secu, 0, 0, 0, "c:\pianopan", startinfo, procnfo)
resultat2 = WaitForSingleObject(procnfo.hProcess, INFINITE)
End Sub
Private Function getpath(filename As String) As String
getpath = Left(filename, InStrRev(filename, "\"))
End Function
Private Function getname(filename As String) As String
Dim temp As String
temp = Right(filename, Len(filename) - InStrRev(filename, "\"))
getname = Left(temp, InStrRev(temp, "\") - 1)
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -