Using cWndInfo to Move through Tabbed Dialogs
Keywords: cSetTabItem cWndInfo tabbed dialogs
Question:
In Windows 95 - Control Panel/Passwords, I have a problem obtaining the handle of the
"User Profile" tab. Sometimes it does and sometimes it doesn't. Even the Windows
Analysis script sometimes lists the tab and its attributes and sometimes it doesn't. Does
anyone have any ideas why this is and how to fix it? Thanks.
Answer:
Things to keep in mind:
- Before you even try to access any controls on that tab, you MUST select the tab,
using the Control Manager's cSetTabItem function to set the tab item before going after handles.
- In many of the tabbed dialogs, the windows are not even brought into existence until
the tab is selected.
- When you click on a tab in a tabbed dialog, this changes the contents of some controls.
; This script creates a report on the windows visible at the time
; the report is run. Run the script. Choose a top-level
; window of interest, and it will show pertainent information
; that may be necessary to use the Control Manager extender.
; Note that Tabbed dialogs sometimes must be displayed before
; their controls are brought into existance. So when using
; tabbed dialogs, tab to the correct dialog first. The
; cWndInfo example shows how to move thru a tabbed dialog.
AddExtender("wwctl34I.dll")
AddExtender("WILX34I.DLL")
verx=cGetInfo(0)
fname="trash.txt"
a=""
moi=DllHwnd("")
topwindow=cWndInfo(moi,4)
nextwindow=topwindow
windowfound=@FALSE
while 1
nextwindow=cWndInfo(nextwindow,6)
if nextwindow==0 then break
hexwnd=xBaseConvert(nextwindow,10,16)
hexwnd=strfixleft(hexwnd,"0",8)
winid=strcat("#WIN$ID#",hexwnd)
wintt=cWndInfo(nextwindow,2)
if a=="" then a=strcat(winid,@tab,wintt)
else a=strcat(a,"|",winid,@tab,wintt)
endwhile
b=AskItemList("Choose a Window",a,"|",@unsorted,@single)
b=ItemExtract(1,b,@tab)
WinClose(b)
exit
Article ID: W12519
Filename: Tabbed Dialogs.txt