Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 168455

Re: SetCursorPos() not working (Win32/Direct3D 10)

$
0
0

I don't see how that should be the default behavior for SetCursorPos(). I have minimalistic win32 code that upon right mouse button click, the mouse cursor moves diagonally:

 

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)

{

     switch (msg)

     {

     case WM_RBUTTONDOWN:

        rbutton();

        break;

     ...

    }

    return 0;

}

 

void rbutton() {

    POINT pos;

    GetCursorPos(&pos);

 

    int x = pos.x;

    int y = pos.y;

    int step = 20;

 

    SetCursorPos(x + step, y + step);

}

 

I have my full bare minimum code here: cursor/main.cpp at master · zwalker1/cursor · GitHub which can be compiled and tested under virtualization, and on a physical machine. On a physical machine, the cursor moves diagonally on right mouse click, under virtualization, it doesn't move at all.

 

I cannot explain the post you refer to, but my guess is that the original poster has issues elsewhere in their code. Previous users on this forum have had similar issues to what I am experiencing: Bug: WinAPI Mouse_Event() and SetCursorPos() broken in VM's? however the solutions they posed do not work under workstation 12 pro.

 

Any help much appreciated.


Viewing all articles
Browse latest Browse all 168455

Trending Articles