WinShowCursor
Appearance
This function shows or hides the cursor that is associated with a specified window.
Syntax
WinShowCursor(hwnd, fShow)
Parameters
- hwnd (HWND) - input
- Handle of window to which the cursor belongs.
- fShow (BOOL) - input
- Show indicator.
- TRUE: Make cursor visible
- FALSE: Make cursor invisible.
Returns
- rc (BOOL) - returns
- Success indicator.
- TRUE: Successful completion
- FALSE: Error occurred, or an attempt was made to show the cursor when it was already visible.
Errors
Possible returns from WinGetLastError
- PMERR_INVALID_HWND (0x1001)
- An invalid window handle was specified.
Remarks
This function must be called by the same thread that created the cursor that is affected.
A cursor show-level count is maintained. It is incremented by a hide operation and decremented by a show operation. The cursor is actually visible if the cursor show-level count is zero, otherwise it is invisible. When decrementing, the cursor show-level count is fixed at zero so as not to show the cursor too many times, but it is possible to hide the cursor a number of times in succession.
Example Code
This example shows the cursor if it is successfully created.
#define INCL_WINCURSORS
#include <os2.h>
HWND hwnd; /* handle of window that has pointer captured */
RECTL rcl;
WinQueryWindowRect(hwnd, &rcl);
if (WinCreateCursor(hwnd, /* This must be the handle */
/* of a window for which */
/* the application can */
/* receive input. */
100, /* x,y position of cursor. */
100,
5, /* cursor width. */
5, /* cursor height. */
CURSOR_FLASH,
&rcl)) /* region where the cursor */
/* is visible. */
WinShowCursor(hwnd,
TRUE); /* make cursor visible. */