home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / source / chap37 / enhanss / module1.bas < prev    next >
BASIC Source File  |  1995-09-28  |  2KB  |  70 lines

  1. Attribute VB_Name = "Module1"
  2. Option Explicit
  3.  
  4. Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long
  5.  
  6. Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As String, ByVal lpFileName As String) As Long
  7. Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
  8.  
  9. Global giCursorDepth As Integer
  10. Global giBeepBox As Integer
  11. Sub Main()
  12. Dim sBeepBox As String
  13. Dim i As Integer
  14. Dim iSize As Integer
  15.  
  16. If App.PrevInstance Then End
  17.  
  18. sBeepBox = "        " ' 8 spaces
  19. iSize = 8
  20. If InStr(Command, "/s") > 0 Then
  21.     CursorOff
  22.     i = GetPrivateProfileString("Screen Saver.Boxes", "BeepBox", "TRUE", sBeepBox, iSize, "CONTROL.INI")
  23.     If UCase(Left(sBeepBox, 4)) = "TRUE" Then
  24.         giBeepBox = True
  25.     Else
  26.         giBeepBox = False
  27.     End If
  28.     frmScreenSaver.Show
  29. ElseIf InStr(Command, "/c") > 0 Then
  30.     frmSetup.Show 1
  31. End If
  32.  
  33. End Sub
  34.  
  35. Public Sub EndScreenSaver()
  36. CursorOn
  37. End
  38. End Sub
  39.  
  40.  
  41. Public Sub Sleep(SnoozeTime As Double)
  42. Dim Start As Double
  43. Start = Timer   ' Set start time.
  44. Do While Timer < (Start + SnoozeTime)
  45.    DoEvents    ' Yield to other processes.
  46. Loop
  47. End Sub
  48.  
  49.  
  50. Public Sub CursorOn()
  51. Dim CurrentCursorDepth As Integer
  52.  
  53. CurrentCursorDepth = ShowCursor(True)
  54. Do While CurrentCursorDepth < giCursorDepth
  55.     CurrentCursorDepth = ShowCursor(True)
  56. Loop
  57. End Sub
  58.  
  59. Public Sub CursorOff()
  60. Dim CurrentCursorDepth As Integer
  61.  
  62. CurrentCursorDepth = ShowCursor(False)
  63. giCursorDepth = CurrentCursorDepth + 1 'Restore original value
  64. Do While CurrentCursorDepth > -1
  65.     CurrentCursorDepth = ShowCursor(False)
  66. Loop
  67.  
  68. End Sub
  69.  
  70.