Posts: 98
Threads: 46
Joined: Oct 2008
How can in QM we can check for a cursor change? Basically I am developing QM which imports data into excel and perforns various operations. Problem is that when files are big they consume time due to which delay becomes useless. Now I want that when the cursor changes busy to normal then other steps should be performed.
Posts: 11,869
Threads: 138
Joined: Dec 2002
Look for 'wait for cursor' in Wait dialog.
Posts: 98
Threads: 46
Joined: Oct 2008
There are limited cursors option available in wait for cursor. How do we use it for others non standard cursors.
Posts: 11,869
Threads: 138
Joined: Dec 2002
Function
WaitForCursor
;/
function ^waitmax cursorCrc [flags] ;;waitmax: 0 is infinite. flags: 1 wait for different cursor
;Waits for cursor (mouse pointer).
;waitmax - max number of seconds to wait. 0 is infinite.
;cursorCrc - value returned by CursorCrc function.
if(waitmax<0 or waitmax>2000000) end ES_BADARG
opt waitmsg -1
int wt(waitmax*1000) t1(GetTickCount) crc
rep
,crc=CursorCrc
,if(flags&1) if(crc!=cursorCrc) ret
,else if(crc=cursorCrc) ret
,
,0.2
,if(wt and GetTickCount-t1>=wt) end "wait timeout"
Function
CursorCrc
;/
function#
;Returns CRC of current cursor's mask bitmap data.
;If fails, returns 0.
CURSORINFO ci.cbSize=sizeof(ci)
if(!GetCursorInfo(&ci) or ci.flags&CURSOR_SHOWING=0) ret
ICONINFO ii
if(!GetIconInfo(ci.hCursor &ii) or !ii.hbmMask) ret
if(ii.hbmColor) DeleteObject(ii.hbmColor)
__GdiHandle h=CopyImage(ii.hbmMask IMAGE_BITMAP 0 0 LR_COPYDELETEORG|LR_CREATEDIBSECTION)
BITMAP b
if(!GetObject(h sizeof(b) &b) or !b.bmBits) ret
ret Crc32(b.bmBits b.bmHeight*b.bmWidthBytes)
How to use:
1. Create these 2 functions.
2. Create macro
Macro
Trigger
F7
Run the macro when is displayed cursor you need. It displays a number in qm output. Use the number with WaitForCursor. Example:
Macro
WaitForCursor 0 1789311001