directplay.bas

来自「在winsock基础上实现的语音聊天」· BAS 代码 · 共 52 行

BAS
52
字号
Attribute VB_Name = "DirectPlay"
Public Sub InitDplay()
    Set dp = dx.DirectPlayCreate("")
    Set dpl = dx.DirectPlayLobbyCreate()
End Sub

Public Sub InitAddress()
    
    If gIP <> "" Then
        Set dpa = dpl.CreateINetAddress(gIP, 0)
    Else
        Set dpa = dpl.CreateINetAddress("", 0)
    End If
    
    dp.InitializeConnection dpa
End Sub

Public Sub JoinChat()

    If dp Is Nothing Then Call InitDplay 'init dplay
    If dpa Is Nothing Then Call InitAddress 'init the dplay address
    
    frmJoin.Show 1  ' show the join form
    
    
End Sub


Public Sub StartMessageEngine()
    frmMain.tmrMSG.Interval = 500
    frmMain.tmrMSG.Enabled = True
End Sub




Public Sub CleanUp()
    
    Set dpa = Nothing
    Set dpM = Nothing
    Set dpl = Nothing
    Set dp = Nothing
    
    
    Set dsb = Nothing
    Set ds = Nothing
    Set dscb = Nothing
    Set dsc = Nothing
    Set dx = Nothing
    
End Sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?