Developer Guide and Reference

ID 767251
Date 10/31/2024
Public
Document Table of Contents

SETMOUSECURSOR

Quickwin Function: Sets the shape of the mouse cursor for the window in focus. This routine is only available for Windows.

Module

USE IFQWIN

USE IFWIN

oldcursor = SETMOUSECURSOR (newcursor)

newcursor

(Input) INTEGER(4). A Windows HCURSOR value. For many predefined shapes, LoadCursor(0, shape) is a convenient way to get a legitimate value. See the list of predefined shapes below.

A value of zero prevents the cursor from being displayed.

Results

The result type is INTEGER(4). This is also an HCURSOR Value. The result is the previous cursor value.

The window in focus at the time SETMOUSECURSOR is called has its cursor changed to the specified value. Once changed, the cursor retains its shape until another call to SETMOUSECURSOR.

In Standard Graphics applications, units 5 and 6 (the default screen input and output units) are always considered to be in focus.

The following predefined values for cursor shapes are available:

Predefined Value

Cursor Shape

IDC_APPSTARTING

Standard arrow and small hourglass

IDC_ARROW

Standard arrow

IDC_CROSS

Crosshair

IDC_IBEAM

Text I-beam

IDC_ICON

Obsolete value

IDC_NO

Slashed circle

IDC_SIZE

Obsolete value; use IDC_SIZEALL

IDC_SIZEALL

Four-pointed arrow

IDC_SIZENESW

Double-pointed arrow pointing northeast and southwest

IDC_SIZENS

Double-pointed arrow pointing north and south

IDC_SIZENWSE

Double-pointed arrow pointing northwest and southeast

IDC_SIZEWE

Double-pointed arrow pointing west and east

IDC_UPARROW

Vertical arrow

IDC_WAIT

Hour glass

A LoadCursor must be done on these values before they can be used by SETMOUSECURSOR.

Example

! Build as Standard Graphics or QuickWin
    use ifqwin
    use ifwin

    integer*4  cursor, oldcursor
    write(6,*) 'The cursor will now be changed to an hour glass shape'
    write(6,*) 'Hit <return> to see the next change'
    cursor = LoadCursor(0, IDC_WAIT)
    oldcursor = SetMouseCursor(cursor)
    read(5,*)

    write(6,*) 'The cursor will now be changed to a cross-hair shape'
    write(6,*) 'Hit <return> to see the next change'
    cursor = LoadCursor(0, IDC_CROSS)
    oldcursor = SetMouseCursor(cursor)
    read(5,*)

    write(6,*) 'The cursor will now be turned off'
    write(6,*) 'Hit <return> to see the next change'
    oldcursor = SetMouseCursor(0)
    read(5,*)

    write(6,*) 'The cursor will now be turned on'
    write(6,*) 'Hit <return> to see the next change'
    oldcursor = SetMouseCursor(oldcursor)
    read(5,*)

  stop
  end