• In progress
  • Showing and Hiding the Cursor

    Showing and hiding the cursor is controlled through the currently running application on a Windows CE device.
    To control if a cursor is hidden or shown, they would typically call the ShowCursor() system API:

    int ShowCursor( BOOL bShow);

    If bShow is set to true a counter is incremented.
    If bShow is set to false it is decremented.
    If the counter is bigger than zero, the cursor is shown. The return value of this function is the current counter value.

    Although this works well for most applications, there might be a need to hide the cursor completely, even if an application request it to be shown. For instance, if you only have a touch as an input device, you might want to remove the cursor-component completely from the OS-build (SYSGEN_CURSOR).
    If you need the cursor-component, because you want to attach a USB-Mouse or it is a dependency of one of your programs (i.e. some C#-apps need it), you could call ShowCursor() multiple times, so the counter-value is far beyond or below zero.

    Another way would be to directly tell the display-driver to hide/show the cursor. This can be done through the Drvlib-functions CursorOn and CursorOff. Actually, you can only tell the display driver to not draw the cursor or to allow the OS to draw it. If the cursor is hidden because the counter-value is equal to or below zero, CursorOn will not show it. If you encounter this you might want to call:

    while( ShowCursor( TRUE) < 0));

    See the Download-section for a sample, which uses the drvlib_app.dll-functions.

    Download

    Sample Application:

    Patch for TR4CONXS_2008Q4-BSP; Windows Embedded CE6: