wwalschaerts
asked on
HWND of a CDialog...
Hey,
Continuing with my problem for having a CDialog automatically closed after a while, I need to pass the handle window parameter of the CDialog I want to send the message WM_CLOSE.
I have spend plenty of hours searching for a way to have the HWND of that Dialog unsucessfully.
I have already have some help from WxW but it seems he use to develop with Borland. I am using Visual C++ v5. Someone has some more info ???
Here is a part of my CDialog definition :
////////////////////////// ////////// ////////// ////////// ////////// ////////// /
// CLogin_Dlg message handlers
////////////////////////// ////////// ////////// ////////// ////////// ////////// /
// COpen_dlg dialog
COpen_dlg::COpen_dlg(CWnd* pParent /*=NULL*/)
: CDialog(COpen_dlg::IDD, pParent)
{
//{{AFX_DATA_INIT(COpen_dl g)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
Timer = ::SetTimer( "CDialog HWND",0,1000,(TIMERPROC)Ti mer_Proc);
}
void COpen_dlg::DoDataExchange( CDataExcha nge* pDX)
{
CDialog::DoDataExchange(pD X);
//{{AFX_DATA_MAP(COpen_dlg )
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(COpen_dl g, CDialog)
//{{AFX_MSG_MAP(COpen_dlg)
ON_BN_CLICKED(IDC_BUTTON1, On_OpenButton)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
////////////////////////// ////////// ////////// ////////// ////////// ////////// /
Continuing with my problem for having a CDialog automatically closed after a while, I need to pass the handle window parameter of the CDialog I want to send the message WM_CLOSE.
I have spend plenty of hours searching for a way to have the HWND of that Dialog unsucessfully.
I have already have some help from WxW but it seems he use to develop with Borland. I am using Visual C++ v5. Someone has some more info ???
Here is a part of my CDialog definition :
//////////////////////////
// CLogin_Dlg message handlers
//////////////////////////
// COpen_dlg dialog
COpen_dlg::COpen_dlg(CWnd*
: CDialog(COpen_dlg::IDD, pParent)
{
//{{AFX_DATA_INIT(COpen_dl
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
Timer = ::SetTimer( "CDialog HWND",0,1000,(TIMERPROC)Ti
}
void COpen_dlg::DoDataExchange(
{
CDialog::DoDataExchange(pD
//{{AFX_DATA_MAP(COpen_dlg
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(COpen_dl
//{{AFX_MSG_MAP(COpen_dlg)
ON_BN_CLICKED(IDC_BUTTON1,
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//////////////////////////
Th handle should be in the m_hWnd member.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Note you need the dialog's handle only if you are using the ::SendMessage() windows API. You use the dialog object if you are using the MFC SendMessage() member procedure.
BTW, since you are using a Timer procedure, you won't get a WM_TIMER event to the dialog (and hence no OnTimer will be called). The Timer procedure should be NULL if that is what you want.
ASKER
Great ! it's working !
Thanks.
Thanks.