天地玄门的服务端程序是由C++开发的,一共要启动7个服务端窗口。其中第六个是主服务端程序,要等第六个服务端程序 出现 process message count =0 的时候才能 算是真正的启动成功。
VB窗体代码如下:
Const CC_不关闭窗口 As String = " &&pause"
Private Sub Command1_Click()
Shell "namesvr.bat" & CC_不关闭窗口, vbNormalFocus
Command1.Enabled = False
End Sub
Private Sub Command2_Click()
Shell "namesvr_frontsvr.bat" & CC_不关闭窗口, vbNormalFocus
Command2.Enabled = False
End Sub
Private Sub Command3_Click()
Shell "rundbserver.bat" & CC_不关闭窗口, vbNormalFocus
Command3.Enabled = False
End Sub
Private Sub Command4_Click()
Shell "runmailsvr.bat" & CC_不关闭窗口, vbNormalFocus
Command4.Enabled = False
End Sub
Private Sub Command5_Click()
Shell "runwritesvr.bat" & CC_不关闭窗口, vbNormalFocus
Command5.Enabled = False
End Sub
Private Sub Command6_Click()
Shell "runmwserver.bat" & CC_不关闭窗口, vbNormalFocus
Command6.Enabled = False
End Sub
Private Sub Command7_Click()
Shell "runfrontsvr.bat" & CC_不关闭窗口, vbNormalFocus
Command7.Enabled = False
End Sub
Private Sub Command8_Click()
Label1.Caption = "服务器启动中,请稍等..."
List1.Clear
Call Command1_Click
List1.AddItem Command1.Caption
SleepEx 5000
Call Command2_Click
List1.AddItem Command2.Caption
SleepEx 5000
Call Command3_Click
List1.AddItem Command3.Caption
SleepEx 5000
Call Command4_Click
List1.AddItem Command4.Caption
SleepEx 5000
Call Command5_Click
List1.AddItem Command5.Caption
SleepEx 5000
Call Command6_Click
List1.AddItem Command6.Caption
SleepEx 5000
Call Command7_Click
List1.AddItem Command7.Caption
SleepEx 5000
Command8.Enabled = False
Label1.ForeColor = vbBlue
Label1.Caption = "服务器启动完毕"
End Sub
模块代码如下,就一个延时函数,不卡UI的
Private Declare Function timeGetTime Lib "winmm.dll" () As Long
Sub SleepEx(T As Long)
Dim time1 As Long
time1 = timeGetTime
Do
DoEvents
Loop While timeGetTime - time1 < T
End Sub
交流Q 1016058890 天地玄门