GetAncestor not a member of CWnd

  • Thread starter Thread starter D F
  • Start date Start date
D

D F

I have just installed VS .NET moving from VS6 and if I create an MFC
Application (Dialog) and insert the following code in the OnInitialize
method

this->GetAncestor(GA_PARENT);

I get the error message "GetAncestor() : not a member of...".

Additionally if I use ::GetAncestor it says GetAncestor is not a member of
the global namespace. And if I just use GetAncestor is can not find that
method.....

Methods like ::GetWindowText work fine!

Any ideas?

Thanks

D.
 
D F said:
I have just installed VS .NET moving from VS6 and if I create an MFC
Application (Dialog) and insert the following code in the OnInitialize
method

this->GetAncestor(GA_PARENT);

I get the error message "GetAncestor() : not a member of...".

Additionally if I use ::GetAncestor it says GetAncestor is not a member of
the global namespace. And if I just use GetAncestor is can not find that
method.....

Methods like ::GetWindowText work fine!

Any ideas?

Both the declaration and implementation of GetAncestor are wrapped inside an
#if (WINVER >= 0x0500) conditional.
 
BINGO....and thank you....

Ok so I change the WINVER to 0x0500 and it compiles....but why doesn't
0x0400 work? According to the docs it has been in for 98 and NT4

<PASTE>
Windows NT/2000/XP: Included in Windows NT 4.0 SP4 and later.
Windows 95/98/Me: Included in Windows 98 and later.
</PASTE>

and WINVER = 0x0400 and other variables are set correctly for 98 and NT?

Any ideas?

Regards

Daniel.
 
D F said:
BINGO....and thank you....

Ok so I change the WINVER to 0x0500 and it compiles....but why doesn't
0x0400 work? According to the docs it has been in for 98 and NT4

<PASTE>
Windows NT/2000/XP: Included in Windows NT 4.0 SP4 and later.
Windows 95/98/Me: Included in Windows 98 and later.
</PASTE>

and WINVER = 0x0400 and other variables are set correctly for 98 and NT?

Any ideas?

No, I can't say if it makes sense. It doesn't seem to match the WINVER
settings list to me either, but it does match the declaration in the SDK
WinUser.h.
 
Back
Top