home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1999 February / VPR9902A.BIN / Vpr_data / Program / vb / prog / Module1.bas < prev    next >
BASIC Source File  |  1998-11-17  |  4KB  |  134 lines

  1. Attribute VB_Name = "Module1"
  2. '画面全体のコピーを取得
  3. Public Declare Function BitBlt Lib "gdi32" ( _
  4.     ByVal hDestDC As Long, _
  5.     ByVal x As Long, ByVal y As Long, _
  6.     ByVal nWidth As Long, _
  7.     ByVal nHeight As Long, _
  8.     ByVal hSrcDC As Long, _
  9.     ByVal XSrc As Long, ByVal YSrc As Long, _
  10.     ByVal dwRop As Long _
  11. ) As Long
  12.  
  13.  
  14. '長方形を塗りつぶす
  15. Public Declare Function FillRect Lib "user32" ( _
  16.     ByVal hdc As Long, _
  17.     lpRect As RECT, _
  18.     ByVal hBrush As Long _
  19. ) As Long
  20.  
  21. '画面へのハンドルを取得
  22. Public Declare Function GetDesktopWindow Lib "user32" () As Long
  23.  
  24. 'ハンドルをデバイスコンテキストに変換
  25. Public Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
  26.  
  27. 'デバイスコンテキストを解放
  28. Public Declare Function ReleaseDC Lib "user32" ( _
  29.     ByVal hwnd As Long, ByVal hdc As Long _
  30. ) As Long
  31.  
  32. Public Type RECT
  33.     Left As Long
  34.     Top As Long
  35.     Right As Long
  36.     Bottom As Long
  37. End Type
  38.  
  39. 'ウィンドウの位置設定
  40. Public Declare Sub SetWindowPos Lib "user32" ( _
  41.     ByVal hwnd As Long, _
  42.     ByVal hWndInsertAfter As Long, _
  43.     ByVal x As Long, ByVal y As Long, _
  44.     ByVal cx As Long, ByVal cy As Long, _
  45.     ByVal wFlags As Long _
  46. )
  47.  
  48. 'マウスカーソルの表示制御
  49. Public Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long
  50. 'システム起動時間
  51. Public Declare Function GetTickCount Lib "kernel32" () As Long
  52.  
  53. Public Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" ( _
  54.     ByVal lpstrCommand As String, _
  55.     ByVal lpstrReturnString As String, _
  56.     ByVal uReturnLength As Long, _
  57.     ByVal hwndCallback As Long _
  58. ) As Long
  59.  
  60. Public Declare Function mciGetErrorString Lib "winmm.dll" _
  61.         Alias "mciGetErrorStringA" ( _
  62.     ByVal dwError As Long, _
  63.     ByVal lpstrBuffer As String, _
  64.     ByVal uLength As Long _
  65. ) As Long
  66.  
  67. 'SetWindowsPos
  68. Public Const HWND_TOPMOST = -1
  69. Public Const HWND_NOTOPMOST = -2
  70. Public Const HWND_BOTTOM = 1
  71. Public Const PM_NOREMOVE = 0
  72. Public Const PM_NOYIELD = 2
  73. Public Const PM_REMOVE = 1
  74. 'BitBlt
  75. Public Const SWP_NOACTIVATE = &H10
  76. Public Const SWP_NOMOVE = &H2
  77. Public Const SWP_NOSIZE = &H1
  78. Public Const SRCCOPY = &HCC0020
  79. Public Const MERGECOPY = &HC000CA
  80. Public Const MERGEPAINT = &HBB0226
  81. Public Const SRCAND = &H8800C6
  82. Public Const SRCPAINT = &HEE0086
  83.  
  84. Public flagQuit As Boolean
  85.  
  86. Sub Main()
  87.  
  88.     If App.PrevInstance = True Then
  89.         Exit Sub
  90.     End If
  91.     
  92.     Select Case UCase$(Left$(Command$, 2))
  93.     Case "/C"
  94.         Load frmAbout
  95.         frmAbout.lblDescription = App.Comments
  96.         frmAbout.lblDisclaimer = App.LegalCopyright
  97.         frmAbout.Show
  98.         Exit Sub
  99.     
  100.     Case "/A"
  101.         Load frmAbout
  102.         frmAbout.lblDescription = App.Comments
  103.         frmAbout.lblDisclaimer = App.LegalCopyright
  104.         frmAbout.Show
  105.         Exit Sub
  106.     
  107.     Case "/S"
  108.         flagQuit = False
  109.         Randomize
  110.         Load FormMain
  111.         'スクリーンの常に最前面に表示されるよう設定
  112.         Call SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)
  113.         'マウスカーソルを消す
  114. '        Do Until ShowCursor(False) < 0
  115. '        Loop
  116.         
  117.         'スクリーンセーバー動作の部分
  118.         Do
  119.             DoEvents
  120.         Loop While flagQuit = False
  121.         
  122.         'カーソル復活
  123.         Do Until ShowCursor(True) >= 0
  124.         Loop
  125.         '画面復活
  126.         Unload FormMain
  127.  
  128.         Exit Sub
  129.     
  130.     Case Else
  131.         Exit Sub
  132.     End Select
  133. End Sub
  134.