The information in this article applies to:
- Standard and Professional Editions of Microsoft Visual Basic
Programming System for Windows, versions 2.0 and 3.0
SUMMARY
This article demonstrates how to turn on mouse trails by using the Escape()
Windows API function. This works on computers that have video drivers that
support mouse trails -- not all video drivers do. The Escape() function
returns a zero if the function is not supported by the video driver.
MORE INFORMATION
Step by Step to an Application That Turns on Mouse Trails
- 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 a Command Button (Command1) to Form1.
- Add the following code to the General Declarations section of Form1:
' Enter the following Declare statement on one, single line:
Declare Function Escape Lib "GDI" (ByVal hDC As Integer,
ByVal nEscape As Integer, ByVal nCount As Integer, lpInData As Any,
lpOutData As Any) As Integer
Const MouseTrails = 39
Const SizeOfWord = 2
- Add the following code to the Command1_Click event of Form1:
Dim x As Integer
x = 7 ' Set x to one of the following values:
' 1 to 7 : turns mouse trails on and shows 1 to 7 trailers
' 0 : turns off mouse trails
' -1 : turns mouse trails on, reads info from WIN.INI
' -2 : disables mouse trails, doesn t update WIN.INI
' -3 : enables mouse trails, updates WIN.INI
result% = Escape(form1.hDC, MouseTrails, SizeOfWord, x, 0&)
- Run the program. Click the Command1 button to turn on mouse trails.
For more information about the Escape() Windows API function and mouse
trails, please see Windows version 3.1 SDK help file that ships with the
Professional Edition of Visual Basic.
|