I'm trying to map the ID of an item clicked with the ID of the dialog
where it belong.
On the MouseActivate event i can get the ID of the Control but i cannot get
the ID of the Dialog.
Can anybody tell me if it's possible, having a CWnd to get the ID of the
parent of this CWnd ?
I tried the following (having the original pWindow):
UINT iIDWindow;
UINT iIDControl;
CWnd* pParentWnd;
iIDControl = pWindow->GetDlgCtrlID(); // Get
the control ID (this work)
pParentWnd = pWindow->GetParent(); // Get
the Parent of the CWnd (this work)
iIDWindow = GetDlgCtrlID(pParentWnd->GetSafeHwnd()); // Get the ID of the
parent ?
or iIDWindow = pParentWnd->GetDlgCtrlID(); // Get the
ID of the parent ?
But all of them return 0...
I think the problem may be that the dialog does not have a 'Control ID' so
that GetDlgCtrlID() returns 0. The resource ID of the dialog is NOT the control
ID. According to the MSDN documentation for ::GetDlgCtrlID() top level windows
can never have a control ID.
I would suggest comparing pParentWnd->m_hWnd to the dialog you are looking
for. There are other approaches, but this is probably the simplest.
Good Luck,
Jake.
This would be the dialog on which the controls reside, right?
You will notice if you use Spy++ that the controls all have a Control_Id and
the dialog
does not.
So 0 is a reasonable answer to expect back from GetParent()->GetDlgCtrlID();
"Thierry POQUET" <tpo...@eleyms.com> wrote in message
news:DtrR6.388$E42.8411@NewsReader...
In Debug Mode it's possible to see the ID of the Dialog, but the MFC do not
include any function to access it.
However the "m_nIDHelp" member of the class CDialog is a protected member.
Therefore i created a derived CDialog who has an added Funtion called GetID
wich return me the ID of the Dialog box and so far it seem to work a treat.
Unfortunatly this does not work for Menu :)
Thanks a lot for your help.
"Thierry POQUET" <tpo...@eleyms.com> wrote in message
news:DtrR6.388$E42.8411@NewsReader...