Option Explicit
'*******************************************
'绿色SQL Server模块
‘doStartSQLServe,启动SQL Server
‘doCheckSQLServerStatus,查找sqlservr.exe进程
‘doTerminateSQLServer, 杀掉sqlservr.exe进程
'*******************************************
Public Const listen_port = "7788" '监听端口
Public Const instance_name = "GreenSQL" 'SQL Server实例名
Private Const RegFile = "GreenSQL.reg" 'reg文件名
Private bSingleUser As Boolean '单用户模式
'======================用于创建进程API函数常数定义=====================
Private Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessId As Long
dwThreadId As Long
End Type
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 Byte
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
Private Declare Function CreateProcess _
Lib "kernel32" _
Alias "CreateProcessA" (ByVal lpApplicationName As String, _
ByVal lpCommandLine As String, _
ByVal lpProcessAttributes As Long, _
ByVal lpThreadAttributes As Long, _
ByVal bInheritHandles As Long, _
ByVal dwCreationFlags As Long, _
lpEnvironment As Any, _
ByVal lpCurrentDirectory As String, _
lpStartupInfo As STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long
'======================用于创建进程API函数常数定义=====================
'======================用于执行程序API函数常数定义=====================
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 Declare Sub Sleep _
Lib "kernel32" (ByVal dwMilliseconds As Long)
'======================用于执行程序API函数常数定义=====================
'======================用于查找进程和终止进程的API函数常数定义