Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Bot Memories - frmMain.frm

frmMain.frm

Caricato da:
Scarica il programma completo

  1. Dim Min As Integer
  2. Dim Sec As Integer
  3. Dim Mem As Integer
  4. Private Sub cmdabout_Click()
  5. frmabout.Show
  6. End Sub
  7.  
  8. Private Sub cmdadd_Click()
  9. lstmemories.AddItem (txtmemories.Text)
  10. txtmemories.Text = ""
  11. End Sub
  12.  
  13. Private Sub cmdconnect_Click()
  14. Winsock1.Close
  15. Winsock1.Connect txthub.Text, txtport.Text
  16. cmdconnect.Enabled = False
  17. cmddisconnect.Enabled = True
  18. txthub.Enabled = False
  19. txtport.Enabled = False
  20. txtnick.Enabled = False
  21. txtpws.Enabled = False
  22. txtshare.Enabled = False
  23. End Sub
  24.  
  25. Private Sub cmddebug_Click()
  26. frmdebug.Show
  27. End Sub
  28.  
  29. Private Sub cmddisconnect_Click()
  30. Winsock1.Close
  31. cmddisconnect.Enabled = False
  32. cmdconnect.Enabled = True
  33. txthub.Enabled = True
  34. txtport.Enabled = True
  35. txtnick.Enabled = True
  36. txtpws.Enabled = True
  37. txtshare.Enabled = True
  38. End Sub
  39.  
  40. Private Sub cmdend_Click()
  41. End
  42. End Sub
  43.  
  44. Private Sub cmdremove_Click()
  45. On Error Resume Next
  46. lstmemories.RemoveItem (lstmemories.ListIndex)
  47. End Sub
  48.  
  49. Private Sub cmdsave_Click()
  50. On Error Resume Next
  51. Dim i As Integer
  52. CommonDialog1.Filter = "File di Testo|*.txt*"
  53. CommonDialog1.ShowOpen
  54. Open CommonDialog1.FileName For Output As #1
  55. For i = 0 To lstmemories.ListCount - 1
  56. Print #1, lstmemories.List(i)
  57. Next i
  58. Close #2
  59. End Sub
  60.  
  61. Private Sub cmdsettings_Click()
  62. frmsettings.Show
  63. End Sub
  64.  
  65. Private Sub cmdstart_Click()
  66. cmdstart.Enabled = False
  67. cmdstop.Enabled = True
  68. Min = 0
  69. Sec = 0
  70. Mem = 0
  71. Timer1.Enabled = True
  72. End Sub
  73.  
  74. Private Sub cmdstop_Click()
  75. cmdstart.Enabled = True
  76. cmdstop.Enabled = False
  77. Timer1.Enabled = False
  78. End Sub
  79.  
  80. Private Sub cmdtray_Click()
  81. Hook Me.hwnd
  82. AddIconToTray Me.hwnd, Me.Icon, Me.Icon.Handle, "Click destro per tornare normale !"
  83. Me.Hide
  84. End Sub
  85.  
  86. Public Sub SysTrayMouseEventHandler()
  87. SetForegroundWindow Me.hwnd
  88. Me.Show
  89. End Sub
  90.  
  91. Private Sub Rest1_Click()
  92. Unhook
  93. Me.Show
  94. RemoveIconFromTray
  95. End Sub
  96.  
  97. Private Sub Form_Load()
  98. Dim Req
  99. Dim Line() As String
  100. Dim NLine As Integer
  101. Req = MsgBox("Si desidera caricare le memories da un file di testo?", vbYesNo, "Bot Memories")
  102. If Req = vbYes Then
  103. CommonDialog1.Filter = "File di Testo|*.txt*"
  104. CommonDialog1.ShowOpen
  105. Open CommonDialog1.FileName For Input As #1
  106. Do Until EOF(1)
  107. NLine = NLine + 1
  108. ReDim Preserve Line(NLine)
  109. Line Input #1, Line(NLine)
  110. lstmemories.AddItem (Line(NLine))
  111. Loop
  112. Close #1
  113. Else
  114. End If
  115. End Sub
  116.  
  117. Private Sub Timer1_Timer()
  118. Sec = Sec + 1
  119. If Sec = 60 Then
  120. Min = Min + 1
  121. Sec = 0
  122. If Min = Val(txtinterval.Text) Then
  123. Winsock1.SendData "<" & txtnick.Text & "> " & lstmemories.List(Mem) & "|"
  124. Mem = Mem + 1
  125. Min = 0
  126. If Mem = lstmemories.ListCount Then
  127. Mem = 0
  128. End If
  129. End If
  130. End If
  131. End Sub
  132.  
  133. Private Sub txtmemories_KeyPress(KeyAscii As Integer)
  134. If KeyAscii = 13 Then
  135. lstmemories.AddItem (txtmemories.Text)
  136. End If
  137. txtmemories.Text = ""
  138. End Sub
  139.  
  140. Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
  141. Dim Data As String
  142. Dim Str() As String
  143. Dim HName() As String
  144. Winsock1.GetData Data
  145. frmdebug.txtdebug.Text = frmdebug.txtdebug.Text & vbCrLf & Data
  146. If InStr(Data, "$Lock") Then
  147. Str = Split(Data, " ")
  148. Winsock1.SendData "$Key " & LockToKey(Str(1)) & "|"
  149. Winsock1.SendData "$ValidateNick " & txtnick.Text & "|"
  150. ElseIf InStr(Data, "$Hello") Then
  151. Winsock1.SendData "$Version 1.0091|"
  152. Winsock1.SendData "$MyINFO $ALL " & txtnick.Text & " " & frmsettings.txtdesc.Text & " " & frmsettings.txttag.Text & "$ $" & frmsettings.txtconn.Text & Chr(8) & "$" & frmsettings.txtemail.Text & "$" & txtshare.Text & "$|"
  153. ElseIf InStr(Data, "$LogedIn") Then
  154. Winsock1.SendData "$Version 1.0091|"
  155. Winsock1.SendData "$MyINFO $ALL " & txtnick.Text & " " & frmsettings.txtdesc.Text & " " & frmsettings.txttag.Text & "$ $" & frmsettings.txtconn.Text & Chr(8) & "$" & frmsettings.txtemail.Text & "$" & txtshare.Text & "$|"
  156. ElseIf InStr(Data, "$GetPass") Then
  157. Winsock1.SendData "$MyPass " & txtpws.Text & "|"
  158. ElseIf InStr(Data, "$BadPass") Then
  159. MsgBox "La password inserita non è corretta!Cambiarla e riconnettersi!", vbCritical, "Bad Password - Bot Memories"
  160. End If
  161. End Sub
  162.  
  163. Private Sub Winsock1_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
  164. MsgBox "Impossibile connettersi all'hub", vbCritical, "Error - Bot Memories"
  165. cmdconnect.Enabled = True
  166. cmddisconnect.Enabled = False
  167. txthub.Enabled = True
  168. txtport.Enabled = True
  169. txtnick.Enabled = True
  170. txtpws.Enabled = True
  171. txtshare.Enabled = True
  172. End Sub