I only want one instance of the personel vector in memory
but I want the ability to open multiple employee dialogs whether Bosses
or Workers.
Class CDataThread::CWndThread
{
public:
RegisterForData(HWnd*); // CEmployeeDlg will register for post
messages
}
// implemtation of datathread will PostMessage(m_Hwnd, UpdateVector);
// posting vector updates to the Base CEmployeeDlg which will maintian
only one copy of
// pPersonelData.
Class CEmployeeDlg: CDialog
{
CEmployeeDlg::CEmployeeDlg(*hwnd)
{
if(!m_bFirst_Instance)
pDataThread->RegisterForData(this->hwnd);
m_bFirst_Instance=true;
};
static m_bFirst_Instance;
static std::vector *pPersonelData;
afx_msg void OnUpdateVector(); // somehow static and maintains
one static copy of
//
pPersonelData.
};
Class CBossDlg::CBaseDlg
{
CBossDlg::CBossDlg()
// Timer refreshes dialog data with pPersonelData gathered from the
base
// class CEmployeeDlg for a particular Boss.
}
Class CWorkerDlg::CBaseDlg
{
CWorkerDlg::CWorkerDlg()
// Timer refreshes dialog data with pPersonelData gathered from
the base
// class CEmployeeDlg for a particular Worker.
}
The dialogs are very similar only slight differences on controls.
Can this be done by only registering one hwnd to the DataThread so as
to limit the datahandler to post only one message to the CEmployeeDlg
having only one employee vector shared by all open dialogs. Of course
I will lock the vector when making changes etc...
Thanks,
Diana