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:
  1. Dim change As Boolean
  2. Private Const SPI_SETMOUSETRAILS = 93
  3. Private Const SPIF_UPDATEINIFILE = &H1
  4. Private Const SPIF_SENDWININICHANGE = &H2
  5. 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
  6. Private Sub Form_Click()
  7. change = True
  8. Do
  9. DoEvents
  10. If change = False Then Call SystemParametersInfo(SPI_SETMOUSETRAILS, 0, ByVal 0&, SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE): Exit Sub
  11. Call SystemParametersInfo(SPI_SETMOUSETRAILS, 7, ByVal 0&, SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
  12. Loop
  13. End Sub
  14. Private Sub Form_DblClick()
  15. change = False
  16. End Sub
  17. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  18. Me.Cls
  19. Me.Print "Single Click the Form to Start Loop and create Mouse Trail"
  20. Me.Print "Double Click the Form to Stop Loop and stop Mouse Trail"
  21. End Sub

Anyone know how i can stop the flickering? Or can suggest a better way to do this?

Thanks!