开发者

PeekMessage() Resetting the Mouse Cursor

Im currently messing around with changing the mouse cursor within a game like C++ application for Windows XP.

To change the cursor I am using SetCursor() and passing in the desired cursor, which is working. However during the while loop in which PeekMessage() is called the cursor keep getting reset back to the default arrow.

This is the offending loop:

MSG  msg;
while( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) )
{
    TranslateMessage( &msg );
    DispatchMessage( &msg );
}

While debugging I found that the cursor changed during the call to PeekMessage() after which msg.message == 0x200, which should make the message one of these:

WM_MOUSEFIRST = 0x200
WM_MOUSEMOVE = 0x200

I haven't been able to find any information on why this is happening, and have no experience with windows messages.

Thanks.

Edit:

According to here the system redraws the class cursor everytime the mouse moves, effecti开发者_如何学JAVAvely setting it back to the default cursor. With this in mind i added this to the window message callback function:

case WM_SETCURSOR:
    return 0;

problem solved.


How did you debug that? Unless you use SoftIce or some other application which doesn't share the windows mouse pointer, it would be hard to isolate the debugger from the application.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜