I need to use this API to create a Motion trail behind the Mouse cursor. I Also Have to have it in a loop because i switch it on or off depending on where the mouse is.
Paste this in an Empty Form and tell me if your Screen and mouse icon doesnt flicker. In the toolbar Area of VB and Internet explorer also if you grab the edge of a form to stretch the mouse cursor flickers between 2 icons.
VB Code:
Dim change As Boolean Private Const SPI_SETMOUSETRAILS = 93 Private Const SPIF_UPDATEINIFILE = &H1 Private Const SPIF_SENDWININICHANGE = &H2 Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long Private Sub Form_Click() change = True Do DoEvents If change = False Then Call SystemParametersInfo(SPI_SETMOUSETRAILS, 0, ByVal 0&, SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE): Exit Sub Call SystemParametersInfo(SPI_SETMOUSETRAILS, 7, ByVal 0&, SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE) Loop End Sub Private Sub Form_DblClick() change = False End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Me.Cls Me.Print "Single Click the Form to Start Loop and create Mouse Trail" Me.Print "Double Click the Form to Stop Loop and stop Mouse Trail" End Sub
Anyone know how i can stop the flickering? Or can suggest a better way to do this?
Thanks!
![]()
![]()
![]()
![]()
![]()
![]()



Reply With Quote