How to Make Mouse Pointer (Cursor) Maintain Hourglass Shape
ID: Q110542
|
The information in this article applies to:
-
Microsoft Visual Basic Standard and Professional Editions for Windows, versions 2.0, 3.0
SUMMARY
You can have a Visual Basic application program set the mouse pointer
(cursor) to an hour glass shape and wait. However, if the user moves the
mouse over another application's window, the cursor will return to a mouse
pointer. To force the cursor to maintain the hourglass shape even while
over other windows, make the window a system modal window by using the
SetSysModalWindow Windows API function.
MORE INFORMATIONStep-by-Step Instructions for Making a System Modal Window
- Start Visual Basic, or if Visual Basic is already running, choose New
Project from the File menu (ALT, F, N). Form1 is created by default.
- Add the following code to the General Declarations section of Form1:
Declare Function SetSysModalWindow% Lib "User" (ByVal hwnd%)
Const HourGlass = 11
- Add the following code to the Form_Load event of Form1:
Sub Form1_Load ()
Me.Show
Screen.MousePointer = HourGlass
' Remove the following line to see how the mouse behaves without it
result% = SetSysModalWindow%(form1.hWnd)
End Sub
- Add the following code to the Form_Click event of Form1:
Sub Form1_Click ()
Unload Form1
End Sub
- Run the program. Click the form to end it. Notice that the cursor
remains an hourglass even when you move the mouse pointer over other
windows.
For more information about the SetSysModalWindow Windows API function, see
the Windows version 3.1 SDK help file that ships with the Professional
Edition of Visual Basic for Windows.
Additional query words:
2.00 3.00
Keywords :
Version :
Platform :
Issue type :
|