home *** CD-ROM | disk | FTP | other *** search
/ Chip Special: HTML & Java / Chip-Special_1997-01_HTML-a-Java.bin / chatsdk / chatsdk.exe / GLOBALS.BAS < prev    next >
Encoding:
BASIC Source File  |  1996-12-12  |  2.6 KB  |  91 lines

  1. Attribute VB_Name = "Globals"
  2. Option Explicit
  3.  
  4. Global Const MASK_PRIVILEGES = 1
  5. Global Const MASK_IGNORED = 4
  6.  
  7. Global Const STAT_HOST = 1
  8. Global Const STAT_PARTICIPANT = 2
  9. Global Const STAT_SPECTATOR = 4
  10. Global Const STAT_IGNORED = 16
  11.  
  12. Global Const RN_MODERATOR = 1
  13. Global Const RN_GUEST = 2
  14. Global Const RN_PARTICIPANT = 3
  15.  
  16. Global Const APP_TITLE = "Executive Chat Monitoring Tool"
  17.  
  18. Global Const UIOPT_HOST = 3596
  19. Global Const UIOPT_MODERATOR = 3596
  20. Global Const UIOPT_GUEST = 3865
  21.  
  22. Global Const MSCHAT_TOP = 2160
  23. Global Const FUNCTIONS_TOP = 1440
  24.  
  25. Global nLogFile As Integer
  26. Global nRealNameType As Integer
  27. Global lModeratorID As Long
  28. Global lGuestID As Long
  29.  
  30. Declare Function GetPrivateProfileStringA Lib "Kernel32" (ByVal lpApplicationName As String, lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Integer, ByVal lpFileName As String) As Integer
  31.  
  32. Sub CloseLogFile()
  33.     On Error Resume Next
  34.     WriteLogFile "End of Log"
  35.     Close #nLogFile   ' Close file.
  36. End Sub
  37.  
  38. Sub DisplayError(strProcedure As String)
  39.     If (Err.Number < 1000 Or Err.Number > 1090) Then
  40.         MsgBox Err.Description, vbOKOnly, "Error " + CStr(Err.Number) + " in " + strProcedure
  41.     End If
  42.     WriteLogFile Err.Description + ", Error " + CStr(Err.Number) + " in " + strProcedure
  43. End Sub
  44.  
  45. Sub OpenLogFile()
  46.  
  47.     On Error Resume Next
  48.     
  49.     Dim nSuffix As Integer
  50.     
  51.     nLogFile = FreeFile   ' Get unused file number.
  52.     nSuffix = 0
  53.     
  54.     Do
  55.         Err.Clear
  56.         Open "ExecChat" & CStr(nSuffix) & ".Log" For Output Lock Write As #nLogFile ' Create filename.
  57.         nSuffix = nSuffix + 1
  58.     Loop Until (Err.Number = 0 Or nSuffix > 32)
  59.     
  60.     If (Err.Number = 0) Then
  61.         Write #nLogFile, "ExecChat Log File"  ' Output text.
  62.     End If
  63. End Sub
  64.  
  65. Function VBGetPrivateProfileString(sAppName$, sKeyName$, sDefault$, sFileName$) As String
  66. Static sProfileBuf As String * 127
  67. Dim nret%
  68.  
  69.   On Error GoTo errVBGetPrivateProfileString
  70.  
  71.  'nret% = GetPrivateProfileString(sAppName$, ByVal sKeyName$, sDefault$, sProfileBuf$, Len(sProfileBuf$), sIniDir$ + sFileName$)
  72.   nret% = GetPrivateProfileStringA(sAppName$, ByVal sKeyName$, sDefault$, sProfileBuf$, Len(sProfileBuf$), sFileName$)
  73.   If nret% = 0 Then
  74.     VBGetPrivateProfileString = ""
  75.   Else
  76.     VBGetPrivateProfileString = Left$(sProfileBuf$, nret%)
  77.   End If
  78.   Exit Function
  79.   
  80. errVBGetPrivateProfileString:
  81.     DisplayError "VBGetPrivateProfileString"
  82.     VBGetPrivateProfileString = ""
  83. End Function
  84.  
  85. Sub WriteLogFile(strLog As String)
  86.     On Error Resume Next
  87.     Write #nLogFile, strLog  ' Output text.
  88. End Sub
  89.  
  90.  
  91.