ImageGear for C and C++ on Windows v19.2 - Updated
ART_GUI_cursor_query
API Reference Guide > ART Component API Reference > ART Component Functions Reference > GUI Functions > ART_GUI_cursor_query

This function returns the type of cursor that is used when the mouse passes over marks or resizes handles.

Declaration:

 
Copy Code
AT_ERRCOUNT ART_GUI_cursor_query(
        HIGEAR hIGear, 
        DWORD dwGrpID, 
        HWND hWnd, 
        AT_MODE nMode, 
        const LPAT_POINT lpPoint, 
        HCURSOR FAR* lpCursor, 
        LPAT_MODE lpCursorType
);

Arguments:

Name Type Description
hIGear HIGEAR HIGEAR handle to the image.
dwGrpID DWORD Identifier of group.
hWnd HWND Windows handle to the image window.
nMode AT_MODE An ART-defined constant of type AT_MODE that indicates the current user mode: run mode or edit mode.
lpPoint const LPAT_POINT An ART-defined constant of type AT_POINT that gives the screen coordinates of the mouse position.
lpCursor HCURSOR FAR* A far pointer to a Window's cursor. ART will fill the memory that the HCURSOR pointer points to with a cursor of type HCURSOR.
lpCursorType LPAT_MODE A far pointer to an ART-defined constant of type AT_MODE that gives the suggested type of cursor to use.

Return Value:

Returns the number of ImageGear errors that occurred during the function call.

Supported Raster Image Formats:

All pixel formats supported by ImageGear for C and C++.

Sample:

Annotation

Example:

 
Copy Code
HIGEAR hIGear; /* HIGEAR handle of image */
AT_POINT pt; /* Cursor position  */
HWND hwnd;  /* Windows handle to the   */
/* window    */
AT_MODE nUserMode; /* Run mode or edit mode */
DWORD dwGrpID;
nUserMode = ART_MODE_EDIT;
. . . 
case WM_SETCURSOR:
if (IG_image_is_valid(hIGear))
{
GetCursorPos(&ptPos);
ScreenToClient(hWnd, &ptPos);
pt.x = ptPos.x, pt.y = ptPos.y;
/* Ask ART to provide the cursor */
dwGrpID = IG_GRP_DEFAULT;
ART_GUI_cursor_query(hIGear, dwGrpID, 
hWnd, nUserMode, 
&pt, &hCursor, NULL);
SetCursor(hCursor);
return TRUE;
}

Remarks:

You can set nMode to a constant beginning with ART_MODE_ to find out what cursor is used in a particular mode (run or edit). The cursor type is chosen by ART. You then call the Windows function SetCursor() and use ART's cursor or a cursor of your own.

This function is called in response to a Windows WM_SETCURSOR message with nMode set to either the run or edit mode constant. lpPoint is the current position of the mouse cursor. lpCursor returns the cursor the library determined for use. If lpCursorType is not NULL, it is set with a constant identifier that indicates which one of the standard cursors is set in lpCursor. The application can choose to use its own cursor for the given lpCursorType. Do not delete the cursor returned in lpCursor with DeleteObject().

In the lpCursorType parameter, one of these values is returned:

ART_CURSOR_NESW ART_CURSOR_ANY
ART_CURSOR_NS ART_CURSOR_NOT_OVER_MARK
ART_CURSOR_NWSE ART_CURSOR_SELECT
ART_CURSOR_EW ART_CURSOR_MOVE
ART_CURSOR_WE ART_CURSOR_OVER_MARK
ART_CURSOR_SENW ART_CURSOR_CREATE_MARK
ART_CURSOR_SN ART_CURSOR_WAIT
ART_CURSOR_SWNE

An error is set if any of the following conditions are met: