MouseShape

Windows management function.

The MouseShape function returns the shape of the mouse pointer as an integer.

Usage

Mainly used for inserting 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

MouseShape()
or
current_val=MouseShape()

Return value

current_val, integer corresponding to the shape of the mouse as below (standard Windows values) :

Standard arrow and small hourglass

1

Normal arrow pointer

2

I-beam pointer

4

Hourglass

14

Cross

3

4-direction arrow

8

NW-SE arrow

11

NE-SW arrow

9

East-West arrow

12

North-South arrow

10

 

Remarks

This statement can be used to synchronize WinTask with the application, for instance, to wait until the hourglass disappears.

Example

Cursor_Val=MouseShape()

Example code

This script includes a synchronization function which waits until the hourglass has disappeared ; this function can then be used to wait the mouse shape change before executing next line.

 
function wait_cursor()

local sortie

sortie=0

 

repeat

if mouseshape()=14 then

pause 1

else

sortie=1

endif

until sortie=1

 

endfunction

 

'Example how to use it 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\Norton AntiVirus\Navw32.exe"+Chr$(34),1)

'Test that the application is totally loaded.

wait_cursor()

This script displays some cursor values in NotePad.

msg$="Cursor value is : "

shell ("notepad.exe")

 

SizeWindow("NOTEPAD.EXE|Notepad|Untitled - Notepad",0,596,427)

MoveWindow("NOTEPAD.EXE|Notepad|Untitled - Notepad",0,65,78)

 

UseWindow("NOTEPAD.EXE|Notepad|Untitled - Notepad",0)

ChooseMenu(System,"&Move")

pause 2

a=MouseShape()

sendkeys("<Esc>")

 

Rem display the value returned by MouseShape

msgframe (msg$+str$(a),1,0,0,12,255)

pause 2

RemoveFrame(1)

 

MoveMouse(594,100)

pause 2

a=MouseShape()

msgframe (msg$+str$(a),1,0,0,12,255)

pause 2

RemoveFrame(1)

 

 

UseWindow("NOTEPAD.EXE|Notepad|Untitled - Notepad",1)

ChooseMenu(Normal,"&File|E&xit")