WM_QUERYDRAGICON

3.0

WM_QUERYDRAGICON

The WM_QUERYDRAGICON message is sent to a minimized (iconic) window that does not have an icon defined for its class. The system sends this message whenever it needs to display an icon for the window.

Parameters

This message has no parameters.

Return Value

An application should return a doubleword value that contains a cursor or icon handle in the low-order word. The cursor or icon must be compatible with the display driver's resolution. If the application returns NULL, the system displays the default cursor. The default return value is NULL.

Comments

If an application returns the handle of an icon or cursor, the system converts the icon or cursor to black-and-white.

The application can call the LoadCursor or LoadIcon function to load a cursor or icon from the resources in its executable file and to obtain this handle.

Example

This example returns an icon handle in response to the WM_QUERYDRAGICON message. The icon is loaded from the resources in the application's executable file.

static HICON hIcon;

switch(msg) {
    case WM_CREATE:

        /* Load icon resource. */

        hIcon = LoadIcon(hInstance, (LPCSTR) "MyIcon");
        .
        . /* Initialize other variables. */
        .

        return 0L;

    case WM_QUERYDRAGICON:

        /* Icon is about to be dragged. Return handle to custom icon. */

        return (hIcon);

    .
    . /* Process other messages. */
    .

}

See Also

LoadCursor, LoadIcon