I made a simple auto clicker in vb. It works great in all windows applications, such as microsoft word, paint, etc. But when I try to use it in a game, like Conquer it will not work. It will click in the predetermined coordinates but nothing happens in the game. Its as if it were clicking straight through the game. Can someone help me fix this?

the code looks like this:

Public Declare Function GetCursorPos Lib "user32" Alias "GetCursorPos" (ByVal lpPoint As POINTAPI) As Long
Public Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)


Function MoveMouse()

Dim MousePos As POINTAPI
Call GetCursorPos(MousePos)

Cursor.Position = New Point(xpos, ypos)

mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0)
Sleep(1000)
mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0)
Sleep(1000)
mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0)
Sleep(1000)
mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0)

xpos = screenresx
ypos = screenresy

Return (MousePos)
End Function

(with some unnecessary code not posted)