cGetControlImageCrc

Creates a Cyclic Redundancy Check (CRC) value of the on-screen image of a Windows control.

Syntax:

cGetControlImageCrc(window-handle)

Parameters:

(i) window-handle window handle of control to create CRC value for.

Returns:

(i) image-crc CRC value of control image.

 

Use this function to create a Cyclic Redundancy Check (CRC) value of the on-screen image of a Windows control. Different CRCs can be obtained for different visual states of a control. The CRCs can be saved and later used to determine the current state of the control by comparing the control's current CRC with the saved CRCs.

Note: Cyclic Redundancy Check is an error-checking technique in which a remainder is calculated by dividing binary content by a prime binary divisor. Differences (errors) are detected by comparing the calculated remainder to a stored remainder.

 

Example:

AddExtender("wwctl44i.dll",0,"wwctl64i.dll")

; Define ini file name moi=IntControl(1004,0,0,0,0) moipath=FilePath(moi) inifile=StrCat(moipath,"test.ini")
Run("notepad.exe","") hNoteWnd=cWndByWndSpec("Notepad","NOTEPAD",1,15) cSetFocus(hNoteWnd) ;Selects target window to receive keystrokes TimeDelay(1) SendKey(`!fo`) ;Sends Keystrokes window1=cWndByWndSpec("#32770","NOTEPAD",13,1091,1137,1088,1120,1121,1090,1152,1089,1136,1040,1,2,1038) ControlHandle=cWndbyname(window1,`Open~`) ; So if we assume that we have no idea about the "Open" button, as to ; whether it is disabled or green or whatever… While 1    TimeDelay(2)    crc=cGetControlImageCRC(ControlHandle)    ;What is it    ;Assume options are "normal" "disabled" "green"    state=IniReadPvt("DaOpenButton",crc,"unknown",inifile)    If state=="unknown"       list="normal disabled green"       state=AskItemlist("What state is the open button in? %crc%",list," ",@SORTED,@SINGLE)       IniWritePvt("DaOpenButton",crc,state,inifile)    EndIf    Pause("Button State",state) EndWhile

See Also:

cWndState