Show/hide mouse cursor in WinCE
Commenting out below code in the function MovePointer of C:\WINCE600\PLATFORM\SMDKV210\SRC\DRIVERS\DISPLAY\DISPLAY_DRV\cursor.cpp will hide the mouse cursor.
if (xPosition != -1 || yPosition != -1)
{
// compute new cursor rect
m_CursorRect.left = xPosition - m_CursorHotspot.x;
m_CursorRect.right = m_CursorRect.left + m_CursorSize.x;
m_CursorRect.top = yPosition - m_CursorHotspot.y;
m_CursorRect.bottom = m_CursorRect.top + m_CursorSize.y;
CursorOn();
}
However, if a mouse is connected, we still have to show cursor anyway. For each mouse attachment, the HIDDeviceAttach function in C:\WINCE600\PUBLIC\COMMON\OAK\DRIVERS\USB\CLASS\HID\CLIENTS\MOUHID\BASE\mouhid.cpp will be invoked. For each mouse detachment, the HIDDeviceNotifications function in the same cpp file will be invoked.
Thus, we can have a way to add some codes in mouse attachment/detachment code and pass the state to the cursor.cpp to control the show/hide of mouse cursor.
if (xPosition != -1 || yPosition != -1)
{
// compute new cursor rect
m_CursorRect.left = xPosition - m_CursorHotspot.x;
m_CursorRect.right = m_CursorRect.left + m_CursorSize.x;
m_CursorRect.top = yPosition - m_CursorHotspot.y;
m_CursorRect.bottom = m_CursorRect.top + m_CursorSize.y;
CursorOn();
}
However, if a mouse is connected, we still have to show cursor anyway. For each mouse attachment, the HIDDeviceAttach function in C:\WINCE600\PUBLIC\COMMON\OAK\DRIVERS\USB\CLASS\HID\CLIENTS\MOUHID\BASE\mouhid.cpp will be invoked. For each mouse detachment, the HIDDeviceNotifications function in the same cpp file will be invoked.
Thus, we can have a way to add some codes in mouse attachment/detachment code and pass the state to the cursor.cpp to control the show/hide of mouse cursor.
留言
張貼留言