Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cursor Change
#1
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.
#2
Look for 'wait for cursor' in Wait dialog.
#3
There are limited cursors option available in wait for cursor. How do we use it for others non standard cursors.
#4
Function WaitForCursor
Code:
Copy      Help
;/
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
Code:
Copy      Help
;/
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     Help - how to add the trigger to the macro
Code:
Copy      Help
out CursorCrc

Run the macro when is displayed cursor you need. It displays a number in qm output. Use the number with WaitForCursor. Example:
Macro
Code:
Copy      Help
WaitForCursor 0 1789311001


Forum Jump:


Users browsing this thread: 1 Guest(s)