Dark Mage
December 22nd, 2003, 11:44 AM
I've created an ATL Project. The object needs to be able to expose methods and properties either through a gui (dialog) or programmatically (ie script). So I have a function called ShowDialog() that uses CreateDialog() to create a member HWND. A client could have several of these interfaces implimented at one time, so I want to avoid globals. I admit being spoiled with MFC. How can I reach my component member variables within my static DialogProc? The proc has to be static or global, right?
example:
class ATL_NO_VTABLE CMyInterface :
public IMyInterface
{
private:
bool m_bDlgEnabled;
int nXPos;
int nYPos;
HWND m_hWnd;
STDMETHOD ShowDialog()
{
m_hWnd = CreateDialog(...,...,DialogProc);
//my need fails if done here, child windows "aren't a window yet", so looking to do in INITDIALOG
...
}
void MemberFunction()
{
}
static INT_PTR CALLBACK DialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_INITDIALOG:
{
//Access MemberFunction()
//and m_bDlgEnabled????
}
break;
}
}
}
Thanks...
example:
class ATL_NO_VTABLE CMyInterface :
public IMyInterface
{
private:
bool m_bDlgEnabled;
int nXPos;
int nYPos;
HWND m_hWnd;
STDMETHOD ShowDialog()
{
m_hWnd = CreateDialog(...,...,DialogProc);
//my need fails if done here, child windows "aren't a window yet", so looking to do in INITDIALOG
...
}
void MemberFunction()
{
}
static INT_PTR CALLBACK DialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_INITDIALOG:
{
//Access MemberFunction()
//and m_bDlgEnabled????
}
break;
}
}
}
Thanks...