Hi, I have this as my Custom Cursor:

vb Code:
  1. Dim newCursor As Cursor = CreateCursor(Cursor1.PictureBox1.Image)
  2.             Me.Cursor = newCursor

And then it appears for about 1 second then goes to the original cursor look!

Thats just Error 1!

In ths moving class that I made!

vb Code:
  1. Public Class CustomCursor
  2.     Private Declare Sub SetCursorPos Lib "User32" (ByVal X As Integer, ByVal Y As Integer)
  3.     Private Const MOUSEEVENTF_LEFTDOWN = &H2
  4.     Private Const MOUSEEVENTF_LEFTUP = &H4
  5.     Private Const MOUSEEVENTF_RIGHYDOWN = &H6
  6.     Private Const MOUSEEVENTF_RIGHTUP = &H8
  7.     Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Integer, ByVal dx As Integer, ByVal dy As Integer, ByVal cButtons As Integer, ByVal dwExtraInfo As Integer)
  8.  
  9.     Public Function MoveCursor(ByVal X As Integer, ByVal Y As Integer) As Single
  10.         Try
  11.             Dim IntX As Integer = CleanInteger(X, Form1.Location.X)
  12.             Dim IntY As Integer = CleanInteger(Y, Form1.Location.Y)
  13.             If Cursor.Position.X = IntX Then
  14.             Else
  15.                 If Cursor.Position.X < IntX Then
  16.                     SetCursorPos(Cursor.Position.X + 1, Cursor.Position.Y)
  17.                 ElseIf Cursor.Position.Y > IntX Then
  18.                     SetCursorPos(Cursor.Position.X - 1, Cursor.Position.Y)
  19.                 End If
  20.             End If
  21.             If Cursor.Position.Y = IntY Then
  22.             Else
  23.                 If Cursor.Position.Y < IntY Then
  24.                     SetCursorPos(Cursor.Position.X, Cursor.Position.Y + 1)
  25.                 ElseIf Cursor.Position.Y > IntY Then
  26.                     SetCursorPos(Cursor.Position.X, Cursor.Position.Y - 1)
  27.                 End If
  28.             End If
  29.             If Cursor.Position.X = IntX Then
  30.                 If Cursor.Position.Y = IntY Then
  31.                     mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
  32.                     mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
  33.                     Exit Function
  34.                 End If
  35.             End If
  36.             SpeedMove(X, Y)
  37.         Catch
  38.         End Try
  39.     End Function
  40.  
  41.     Public Function CleanInteger(ByVal Int As Integer, ByVal Target As Integer) As String
  42.         Dim i As Integer
  43.         i = Target + Int
  44.         Return i
  45.     End Function
  46.  
  47.     Public Function SpeedMove(ByVal X As Integer, ByVal Y As Integer) As Single
  48.         Try
  49.             Dim IntX As Integer = CleanInteger(X, Form1.Location.X)
  50.             Dim IntY As Integer = CleanInteger(Y, Form1.Location.Y)
  51.             If Cursor.Position.X = IntX Then
  52.             Else
  53.                 If Cursor.Position.X < IntX Then
  54.                     SetCursorPos(Cursor.Position.X + 1, Cursor.Position.Y)
  55.                 ElseIf Cursor.Position.Y > IntX Then
  56.                     SetCursorPos(Cursor.Position.X - 1, Cursor.Position.Y)
  57.                 End If
  58.             End If
  59.             If Cursor.Position.Y = IntY Then
  60.             Else
  61.                 If Cursor.Position.Y < IntY Then
  62.                     SetCursorPos(Cursor.Position.X, Cursor.Position.Y + 1)
  63.                 ElseIf Cursor.Position.Y > IntY Then
  64.                     SetCursorPos(Cursor.Position.X, Cursor.Position.Y - 1)
  65.                 End If
  66.             End If
  67.             If Cursor.Position.X = IntX Then
  68.                 If Cursor.Position.Y = IntY Then
  69.                     mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
  70.                     mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
  71.                     Exit Function
  72.                 End If
  73.             End If
  74.             MoveCursor(X, Y)
  75.         Catch
  76.         End Try
  77.     End Function
  78. End Class

It gets errors on some bits of the code different bit of code the odd time, I have recorded some below also here is the error!

Error:
Code:
An unhandled exception of type 'System.StackOverflowException' occurred in Microsoft.VisualBasic.dll
Bits Error Occured:
vb Code:
  1. Return i
From the CleanInteger Function

Hardly anything else but once I got it on

vb Code:
  1. If Cursor.Position.X = IntX Then
At the bottom of the SpeedMove Function