Home > Language Reference > Windows Management Functions > MouseShape

MouseShape

The MouseShape function returns how the mouse pointer looks like.

Usage

Used to insert an advanced synchronization method. For example, if a text refresh within a window can only be dectected by the mouse shape changing from the hourglass to the standard arrow, MouseShape function allows to insert the correct synchronization (see example code below).

Syntax

var=MouseShape()

Parameters

None.

Return value

var, integer indicating the shape of the mouse pointer. The possible values are:
 Mouse shape Return value 
 small hourglass  1
 standard arrow  2
 I-Beam  4
 Hourglass      14
 Cross  3
 4-directional arrow  8
 NW-SE arrow  11
 NE-SW arrow  9
 East-West arrow  12
 North-South arrow  10

Examples

Cursor_Val=MouseShape()
msgbox(cursor_val)

'This script defines a synchronization function which waits until the hourglass has disappeared.
function wait_cursor()
local sortie
sortie=0
repeat
    'If mouse shape is an hourglass, pause for 1 sec and loop
    if mouseshape()=14 then
         pause 1
    else
         'Mouse shape is not anymore an hourglass, assign the value 1 to sortie variable, and so exit the loop
         sortie=1
    endif
until sortie=1
endfunction

'Call example when a program loads many windows and so a simple UseWindow
'is not enough to be sure that all the windows are loaded.
Shell(Chr$(34)+"C:\Program Files (x86)\Norton AntiVirus\Navw32.exe"+Chr$(34),1)
'Test that the application is totally loaded.
wait_cursor()