Hi,
I attached a project about my question. It is created by a class which i found in CodeGuru, a TabControl. From the main dialog file(MyTabExampleDlg.cpp) i want to get the handle of the button but i couldnt.
In fact i can get the handle in "CTabOne" class and store it in same class, then storing it in class as a member.
Code:
class CTabOne : public CDialog
{
// Construction
public:
CTabOne(CWnd* pParent = NULL); // standard constructor
[...]
HWND hbutton;
[...]
};
/////////////////////////////////////////////////////////////////////////////
// CTab1 message handlers
BOOL CTabOne::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
hbutton = ::GetDlgItem(m_hWnd, IDC_BUTTON1);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
Then in the main dialog (MyTabExampleDlg.cpp),
Code:
BOOL CMyTabExampleDlg::OnInitDialog()
{
CDialog::OnInitDialog();
[...]
CTabOne tab1;
HWND buttonHandTest = tab1.hbutton; // << Here!
[...]
return TRUE; // return TRUE unless you set the focus to a control
}
The place which i show in second peace of code, this is not returning the handle. I know i am doing wrong, obviously, but what is the correct one?
Thanks