home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / hdcursor / hidecurs.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-08  |  2.1 KB  |  59 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "Form1"
  4.    ClientHeight    =   2685
  5.    ClientLeft      =   135
  6.    ClientTop       =   5115
  7.    ClientWidth     =   3375
  8.    Height          =   3090
  9.    Left            =   75
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   2685
  12.    ScaleWidth      =   3375
  13.    Top             =   4770
  14.    Width           =   3495
  15.    Begin CommandButton Command1 
  16.       Caption         =   "HideCursor"
  17.       FontBold        =   0   'False
  18.       FontItalic      =   0   'False
  19.       FontName        =   "MS Sans Serif"
  20.       FontSize        =   18
  21.       FontStrikethru  =   0   'False
  22.       FontUnderline   =   0   'False
  23.       Height          =   1995
  24.       Left            =   720
  25.       TabIndex        =   0
  26.       Top             =   720
  27.       Width           =   2655
  28.    End
  29. Option Explicit
  30. Declare Function ShowCursor% Lib "User" (ByVal bShow%)
  31. Sub Command1_Click ()
  32.     'All thanks goes to MikeStanly that have written me a similar example
  33.     'to hide the mouse cursor.  He has also written an article example on
  34.     'how to use custom cursors for the Visual Basic Programmer's Journal.
  35.     'You can download that file here on AOL called CURSOR.ZIP
  36.     '
  37.     '
  38.     'Certain applications when load, will call this function more than once.
  39.     'and Windows will maintain an internal count that is incremented for each
  40.     'call of this function if bShow is True or decremented if bShow is False.
  41.     'The cursor is displayed if the Windows count is greater or equal to 0, and
  42.     'hidden if its less than 0. so if you have tried using this function before
  43.     'and doesn't work 100% of the time. Then you should always use a loop with this
  44.     'function inorder to guaranteed it to work the way you expect it to.
  45.     If Command1.Caption = "HideCursor" Then
  46.        Do While ShowCursor(False) > 0: Loop
  47.        Cls
  48.        Print ShowCursor(False)
  49.        Command1.Caption = "ShowCursor"
  50.     Else
  51.        Do While ShowCursor(True) < 0: Loop
  52.        Cls
  53.        Print ShowCursor(True)
  54.        Command1.Caption = "HideCursor"
  55.     End If
  56.     '
  57.     '
  58. End Sub
  59.