Click to See Complete Forum and Search --> : WM_TIMER in subclassing BUTTON
nukbaby
May 22nd, 1999, 08:50 PM
I make Subclassing button class.
.. example, Mybutton m_button;
File Name are Mybutton.cpp and Mybutton.h
, include CMybutton Class.
and In ClassWizard, I make event, WM_TIMER.
but the event not occur WM_TIMER in subclassing
button class.
Why not???
?? plz help me...
^^
JonJon
May 22nd, 1999, 09:41 PM
You mean that the class wizard does not add the right code to your source files, or that the WM_TIMER event is not received in your CMyButton OnTimer() function?
nukbaby
May 23rd, 1999, 12:39 AM
dear..
Of course, i write..
1. WM_TIMER envet function : On_Timer..
MessageBox("Test Message");
2. WM_CREATE envet function : On_Create;
SetTime(1, 500, NULL );
in subclassing class files.... ( in classWiazrd )
but it's not display messagebox
In Subclassing class, WM_TIMER event ?? occur or not occur.... ??
ps : i'm poor at english sorry...
^^
sally
May 23rd, 1999, 04:03 AM
Can you please publish the relevant pieces of your source code.
1) class definition
2) Message map
3) OnCreate function
4) OnTimer function
please
Sally
Sally
May 23rd, 1999, 04:03 AM
Can you please publish the relevant pieces of your source code.
1) class definition
2) Message map
3) OnCreate function
4) OnTimer function
please
Sally
nukbaby
May 23rd, 1999, 04:59 AM
Please do not reply to this email. This is an automated response
Can you please publish the relevant pieces of your source code.
1) class definition
CMyButton class
2) Message map
By ClassWizard..
3) OnCreate function
CMyButton::OnCreate()
{
SetTimer(1, 500 , NULL );
.....
}
4) OnTimer function
CMyButton::OnTimer()
{
MessageBox("Test MessageBox");
......
}
in Subclassing Fils..
^^
JonJon
May 23rd, 1999, 10:11 AM
Your code should look look similar to the following:
//...
// MyButton.h
//...
// CMyButton window
class CMyButton : public CButton
{
// Construction
public:
CMyButton();
// Attributes
public:
// Operations
public:
void StartTimer();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMyButton)
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CMyButton();
// Generated message map functions
protected:
//{{AFX_MSG(CMyButton)
afx_msg void OnTimer(UINT nIDEvent);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
// Mybutton.cpp
//...
#define TIMER_MYTIMER 101
//...
BEGIN_MESSAGE_MAP(CMyButton, CButton)
//{{AFX_MSG_MAP(CMyButton)
ON_WM_TIMER()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyButton message handlers
void CMyButton::StartTimer()
{
SetTimer(TIMER_MYTIMER, 1000, NULL);
}
void CMyButton::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
if (nIDEvent == TIMER_MYTIMER)
{
KillTimer(TIMER_MYTIMER);
TRACE("Timer message received in CMyButton\n");
}
else
CButton::OnTimer(nIDEvent);
}
Pay close attention to the message map sections.
nukbaby
May 23rd, 1999, 09:32 PM
Thanks!! Your Source Code.. ^^
Very Very Thanks..
^^
Saeed R
May 23rd, 1999, 10:06 PM
i would like to know where nukbaby was going wrong?
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.