Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GetAncestor & GetParent Question
#1
Dear Gintaras,

This is the report of the analysis of the toolbar on a MS_Word Window produced by the QM-function hereinafter.

Quote:Window : LANG_TOOL_WORD
Handle : 2432968
Class : QM_toolbar
Exe : qm

Parent : 5644204
P Name :
P Exe : qm

Ancestors
Parent :
65556 - - csrss
Top-level parent :
2432968 - LANG_TOOL_WORD - qm
Top-level parent or owner :
5644204 - - qm

Function Manage_Windows_Query
Code:
Copy      Help
#sub WinProperties
function int'h

str si.getmacro(getopt(itemid) 1)
str caller.getmacro(getopt(itemid 1) 1);err    caller=si
if ideb; min 0; err out "<>%s : <open ''%s /%i''>%s</open> - Called by : %s" NowT si _error.place si caller

int wp
str spa ste sexe sexep sc smes

ste.getwintext(h)
sc.getwinclass(h)
sexe.getwinexe(h)
wp=GetParent(h)
if wp
,spa.getwintext(wp)
,sexep.getwinexe(wp)
else
,spa=""
,sexep=""

smes.format("Window %c:  %s[]Handle %c:  %i[]Class %c:  %s[]Exe %c:  %s[][]Parent %c:  %i[]P Name %c:  %s[]P Exe %c:  %s[][]Ancestors[]" VK_TAB ste VK_TAB h VK_TAB sc VK_TAB sexe VK_TAB wp VK_TAB spa VK_TAB sexep)

;1 parent, 2 , 3 top-level parent or owner

CStrStack st
st.Push("Parent : ")
st.Push("Top-level parent : ")
st.Push("Top-level parent or owner : ")

int i
for i 1 4
,wp=GetAncestor(h i)
,if wp
,,spa.getwintext(wp)
,,sexep.getwinexe(wp)
,else
,,spa=""
,,sexep=""

,smes.formata("%s[]%i - %s - %s[]" st.out(i-1) wp spa sexep)
,
mes smes "Window Properties" "Oi"
_s.format("Window : %s - Handle : %i - Class : %s" ste h sc)
min 0; err out "<>%s : <open ''%s /%i''>%s</open> - %s" NowT si _error.place si _s

QM Help describes GetAncestor WAPI as it follows :

Quote:GetAncestor(hWnd gaFlags) returns handle of container window. gaFlags: 1 parent (the same as GetParent), 2 top-level parent, 3 top-level parent or owner.

I wonder whether the flag sequence described in this help file (which it coincides with what MSDN says), is correct or not. Unless I misunderstand something.

Many thanks, Best Regards,

Simos
#2
QM toolbars have 2 owners:
1. GetToolbarOwner - the window to which the toolbar is "attached".
2. GetParent - an intermediate window that belongs to QM process and is a child of 1.

GetAncestor(GA_PARENT and GA_ROOTOWNER) - I don't know how it works, never used it.
#3
Many thanks for dealing with it.


Forum Jump:


Users browsing this thread: 1 Guest(s)