Microsoft KB Archive/99608

{| = Simulating SET MOUSE ON|OFF in FoxPro for Windows =
 * width="100%"|

ID: Q99608

2.50 2.50a WINDOWS

The information in this article applies to:


 * Microsoft FoxPro for Windows, versions 2.5 and 2.5a

SUMMARY
In FoxPro for MS-DOS, the SET MOUSE ON|OFF command is used to enable or disable the presence of the mouse cursor on the screen. In FoxPro for Windows, this command is ignored, since all mouse functions are controlled by the Windows operating environment.

You can simulate SET MOUSE ON|OFF in FoxPro for Windows by making the appropriate Windows application programming interface (API) calls. The following code snippet disables or enables the mouse based on the value of the variable &quot;enable&quot; (0 to disable, 1 to enable):

SET LIBRARY TO SYS(2004)+&quot;foxtools.fll&quot; ADDITIVE enable=1 mouse_cur= RegFn(&quot;showcursor&quot;, &quot;I&quot;, &quot;I&quot;) showcursor= CallFn(mouse_cur, enable) IF enable=0 DO WHILE showcursor>=0 showcursor= CallFn(mouse_cur, enable) ENDDO ELSE showcursor= CallFn(mouse_cur, enable) ENDIF RELEASE LIBRARY SYS(2004)+&quot;foxtools.fll&quot;

MORE INFORMATION
WARNING: The functions provided in FOXTOOLS.FLL are not supported by Microsoft. They were developed for internal use only and are provided here, as is, for the benefit of our customers. We make no warranty, implied or otherwise, regarding the performance or reliability of these functions.

The ShowCursor API function sets an internal display counter that determines whether the cursor should be displayed. When the display counter is greater than or equal to 0 (zero), the mouse cursor will be displayed. When the display counter is -1, the mouse cursor will not be displayed. If you pass a 0 to the ShowCursor function, the display counter is decremented by 1; to turn the mouse cursor off, you must continue to call the function until the display counter equals -1.