How to Turn on Mouse Trails with Visual Basic

Last reviewed: February 26, 1996
Article ID: Q110541
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

  1. 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.

  2. Add a Command Button (Command1) to Form1.

  3. 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
    
    

  4. 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&)
    
    

  5. 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.


Additional reference words: 2.00 3.00
KBCategory: kbprg
KBSubcategory: APrgOther


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 26, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.