绿色SQL Server原理(10)VB6启动停止模块[GreenSQL.bas]

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函数常数定义

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值