Ticket #6762 (closed defect: invalid)
Cannot Move Cursor Using Windows API SetCursorPos Function -> working as designed
|Reported by:||saberman||Owned by:|
|Version:||VirtualBox 3.2.0||Keywords:||Cursor SetCursorPos|
VirtualBox 3.2.0 Add-ins 3.2.0
Host: Windows 7 Ultimate x64 Guest: Windows 7 Ultimate x64 Application: MS Access 2007
I am trying to move the mouse using VBA code in an Access 2007 form. I setup a test form with one button in the center of the form. In the click event of the botton I put:
Private Sub cmdMoveMouse_Click() MoveMouseToTopLeftCorner Me.hwnd End Sub
The listing for the module containing the MoveMouseToTopLeftCorner is at the end of this ticket.
If I open the database and press the button the cursor does not move although it does change from a hand (the hover cursor is set to hand) to an arrow which seems to indicate that the system thinks it has left the button. But it hasn't as I can click on the button again.
If I copy the database to a real Windows XP machine and do the same as above the cursor moves to the top left corner of the form and changes to an arrow (which is the expected resuls).
Option Compare Database Option Explicit Private Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Private Type Point x As Long y As Long End Type Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long Private Declare Function ClientToScreen Lib "user32" (ByVal hwnd As Long, lpPoint As Point) As Long Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long Public Function MoveMouseToTopLeftCorner(ByVal vlHwnd As Long) As Boolean Dim lReturn As Long Dim pnt As Point Dim rec As RECT lReturn = GetWindowRect(vlHwnd, rec) pnt.x = rec.Left pnt.y = rec.Top lReturn = SetCursorPos(pnt.x, pnt.y) MoveMouseToTopLeftCorner = (0 <> lReturn) End Function
- Status changed from new to closed
- Resolution set to invalid
- Summary changed from Cannot Move Cursor Using Windows API SetCursorPos Function. to Cannot Move Cursor Using Windows API SetCursorPos Function -> working as designed