Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
; DATE: Fri 8/08/03 2:06:42 PM ; AUTHOR: George Vagenas, Legend Builders ; PURPOSE: Provides an alternative to Control Manager functions for obtaining a handle to a control. ; EXPECTS: Handle to a Top Level window and a criteria string. ; RETURNS: Handle to a control if successful, 0 if not. ; SYNTAX: These examples use the two Edit controls found in Studio's Output window. ; Handle = udfGetHWnd(hApp, "Id==1047") ; Handle = udfGetHWnd(hApp, 'Class=="Edit" && NextSibling!=0') ; Handle = udfGetHWnd(hApp, 'Class=="Edit" && NextSibling==0') ; Handle = udfGetHWnd(hApp, 'Class=="Edit"?NextSibling|rClass|=="Edit"') ;------------------------------------------------------------------------------------------ ; REVISED: Sun 8/10/03 3:26:45 AM by gwv ; COMMENT: Ver. 1.0.1 ; Fixed. There was no "if Tests then return WorkWnd" after ; first "gosub Eval" before the code enters the while loop. ;------------------------------------------------------------------------------------------ :udfGetHWnd #definefunction udfGetHWnd(hApp, Eval) IntControl(73,1,0,0,0) ; Use gosub ErrorHndlr AddExtender("wwctl34i.dll") if Eval=='' then return 0 if hApp!=0 && hApp!='' WorkWnd = hApp else return 0 endif rTitle = 0 rID = 1 rClass = 2 rParent = 3 rFirstSibling = 4 rPreviousSibling = 5 rNextSibling = 6 rLastSibling = 7 rFirstChild = 8 rOwner = 9 rWndStyle = 20 rWndStyleEx = 21 rClassStyle = 22 Sep = ',' Siblings = '' testCnts = itemcount(Eval, '?') gosub GetWndInfo gosub Eval if Tests then return WorkWnd if !FirstChild then return 0 while FirstChild || itemcount(Siblings, Sep) while FirstChild WorkWnd = FirstChild gosub GetWndInfo gosub Eval if Tests then return WorkWnd if NextSibling then Siblings = iteminsert(NextSibling, -1, Siblings, Sep) endwhile ; FirstChild Sib = itemcount(Siblings, Sep) if Sib WorkWnd = itemextract(Sib, Siblings, Sep) Siblings = itemremove(Sib, Siblings, Sep) gosub GetWndInfo gosub Eval if Tests then return WorkWnd if NextSibling then Siblings = iteminsert(NextSibling, -1, Siblings, Sep) endif endwhile return 0 ;--------------------------------------------------------------------------------------- :GetWndInfo Title = cWndInfo(WorkWnd, 0) ID = cWndInfo(WorkWnd, 1) Class = cWndInfo(WorkWnd, 2) Parent = cWndInfo(WorkWnd, 3) FirstSibling = cWndInfo(WorkWnd, 4) PreviousSibling = cWndInfo(WorkWnd, 5) NextSibling = cWndInfo(WorkWnd, 6) LastSibling = cWndInfo(WorkWnd, 7) FirstChild = cWndInfo(WorkWnd, 8) Owner = cWndInfo(WorkWnd, 9) WndStyle = cWndInfo(WorkWnd, 20) WndStyleEx = cWndInfo(WorkWnd, 21) ClassStyle = cWndInfo(WorkWnd, 22) return ;--------------------------------------------------------------------------------------- :Eval Tests = @false ; testCnts = itemcount(Eval, '?') - initialized on entry. for testCnt = 1 to testCnts Query = itemextract(testCnt, Eval, '?') if testCnt==1 if %Query% then Tests = @true else qHndl = itemextract(1, Query, '|') if %qHndl%==0 Tests = @false else Rqst = itemextract(2, Query, '|') TestFor = itemextract(3, Query, '|') Tests = cwndinfo(%qHndl%, %Rqst%)%TestFor% endif endif if !Tests then break next return ;------------------------------------------------------------------- :WBErrorHandler WbtDir = filepath(IntControl(1004, 0, 0, 0, 0)) dirchange(WbtDir) wErrFile = 'udfGetHWnd 1.0.1' wError=LastError() if wError==204 then return wErrStr = IntControl(34,wError,0,0,0) wErrLine = wberrorhandlerline wErrOffset = wberrorhandleroffset wErrAssign = wberrorhandlerassignment wErrRptFile = strcat(wbtDir, 'Error.txt') wErrMessage = 'Please email this file:%@CRLF%%@tab%"%wErrRptFile%"%@CRLF%to gvag@shaw.ca with the Subject line "AnalysisEx Error"' wErrTxt = strCat(`wErrFile = `, wErrFile, @CRLF, `wError = `, wError, @CRLF, `wErrStr = `, wErrStr, @CRLF, `wErrLine = `, wErrLine, @CRLF, `wErrOffset = `, wErrOffset, @CRLF, `wErrAssign = `, wErrAssign, @CRLF, @CRLF, wErrMessage) fw = fileopen(wErrRptFile, 'WRITE') filewrite(fw, wErrTxt) fileclose(fw) run('NotePad.exe', wErrRptFile) clipput(wErrTxt) return #endfunction ;------------------------------------------------------------------------------------------ ; weuglLabelLines=:drillMsg:drillFlds:GetHWnd:GetWndInfo:Eval:WBErrorHandler;***LABEL LIST***
Article ID: W16209
File Created: 2004:03:30:15:43:16
Last Updated: 2004:03:30:15:43:16