-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathForm1.frm
97 lines (90 loc) · 2.89 KB
/
Form1.frm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 8232
ClientLeft = 108
ClientTop = 456
ClientWidth = 4500
LinkTopic = "Form1"
ScaleHeight = 8232
ScaleWidth = 4500
StartUpPosition = 3 'Windows Default
Begin VB.Label labDebug
AutoSize = -1 'True
BackStyle = 0 'Transparent
BeginProperty Font
Name = "Consolas"
Size = 9
Charset = 204
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 216
Index = 0
Left = 168
TabIndex = 1
Top = 336
UseMnemonic = 0 'False
Width = 96
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Label1"
Height = 192
Left = 168
TabIndex = 0
Top = 84
UseMnemonic = 0 'False
Width = 492
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private WithEvents m_oServer As cVncServer
Attribute m_oServer.VB_VarHelpID = -1
Private Sub Form_Load()
Const DEF_PASSWORD As String = "0000"
Dim sAddress As String
Dim lPort As Long
Dim lIdx As Long
For lIdx = 1 To 100
Load labDebug(lIdx)
labDebug(lIdx).Move labDebug(lIdx - 1).Left, labDebug(lIdx - 1).Top + 240
labDebug(lIdx).Visible = True
Next
Set m_oServer = New cVncServer
If Not m_oServer.Init("0.0.0.0", 5900, DEF_PASSWORD) Then
MsgBox m_oServer.LastError, vbExclamation
Unload Me
Else
m_oServer.Socket.GetSockName sAddress, lPort
Label1.Caption = "Waiting for connection on " & sAddress & ":" & lPort & _
IIf(LenB(m_oServer.Password) <> 0, " (password: " & m_oServer.Password & ")", vbNullString)
End If
Set DebugForm = Me
Set ChatWindows = New Collection
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set DebugForm = Nothing
End Sub
Private Sub m_oServer_OnTextChatMsg(ByVal ConnID As Long, ByVal MsgType As Long, ByVal MsgText As String)
Dim oFrmChat As Form2
If MsgType = 0 Then
On Error Resume Next
Set oFrmChat = ChatWindows.Item("#" & ConnID)
On Error Resume Next
If oFrmChat Is Nothing Then
Set oFrmChat = New Form2
If oFrmChat.Init(m_oServer, ConnID) Then
ChatWindows.Add oFrmChat, "#" & ConnID
End If
End If
End If
End Sub