Link to home
Start Free TrialLog in
Avatar of solomon021499
solomon021499

asked on

How to get to protected member m_nIDHelp

There is a protected member variable m_nIDHelp.  I am
not sure if it is a member of the CWnd class or the
CDialog class.  It shows up as a "protected" member
of my CDialog object in the debugger.

Anyway, the question is, is there an access function
available so that I can get to this from outside the
class?  Or am I going to have to subclass from CDialog
and provide my own access function?

By the way, what do I do when an expert answers a
question that is not sufficient?  My question is tagged
as answered and waiting for a grade so no one looks
at it.  The expert said to get back to him if it was
not sufficient, but the only way I have to do this is
by posting a comment and I have had no response for
quite a while.  The first response was virtually
immediate, but now it sits.
ASKER CERTIFIED SOLUTION
Avatar of MarkusLoibl
MarkusLoibl
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of solomon021499
solomon021499

ASKER

Thank you for resonding.  I did see the definition of CDialog in afxwin.h and the void SetHelpID(UNIT nIDR) function.  However, I need to be able to retrieve the value, not set it.

I assume this means that I will have to provide this myself.

Also, thank you for your advice about question status.
you also find in the MFC-sources:

ON_MESSAGE(WM_HELPHITTEST, OnHelpHitTest)
LRESULT CDialog::OnHelpHitTest(WPARAM, LPARAM)
{
 if (m_nIDHelp != 0)
  return HID_BASE_RESOURCE + m_nIDHelp;
 return 0;
}

I think you can use this member to retrieve your actual m_nIDHelp with:
  UINT helpId = myDialog->SendMessage(WM_HELPHITTEST);
  if( helpId ) helpId -= HID_BASE_RESOURCE;
This should work!
I tried it and have not yet been able to get it to work.
It is necessary to include afxpriv.h, but I get many compilation errors in it when I do so.  I assume that it requires yet another header, but I have not yet found it.  Thank you.  I will let you know when I get it.
As I indicated in my last comment, I have not been able to get
UINT helpId = myDialog->SendMessage(WM_HELPHITTEST);
if( helpId ) helpId -= HID_BASE_RESOURCE;
to work when including afxpriv.h.  I do not know how to elimination the multitude of compilation errors that occur when including that file.  I tried defining WM_HELPHITTEST and HID_BASE_RESOURCE myself to the value in afxpriv.h
#define WM_HELPHITTEST      0x0366
#define HID_BASE_RESOURCE   0x00020000UL  
which did work.  However, this is a embarassing work around.  Do you have any ideas, what the problem is.  Do I need to include yet another file?


I use VC++ 5.0 and do not have any problems with it.
I just built up a little example, and I can send you the files with e-mail, if you tell me your email-adress
(send it to:  MarkusLoibl@ThinkTools.com )

I use VC++ 5.0 and do not have any problems with it.
I just built up a little example, and I can send you the files with e-mail, if you tell me your email-adress
(send it to:  MarkusLoibl@ThinkTools.com )