Click here to Skip to main content

Member 7909353 asked:

Open original thread
I have a dialog box and a tab control on it.
class for dialog box is MyDlg and class for tab control is MyTabCtr.
MyDlg.h
class MyDlg: public CDialog
{
enum { IDD = IDD_ZF1SDKLIGHTTUTORIAL_DIALOG };
public:
MyDlg(CWnd* pParent = NULL);// standard constructor
LRESULT ButtonPressed(WPARAM w, LPARAM l);////do this
MyTabCtrl m_cTab; //Reference for tab control class
protected:
virtual void DoDataExchange(CDataExchange* pDX);// DDX/DDV support
}
MyDlg.cpp
BEGIN_MESSAGE_MAP(CZF1SDKLightTutorialDlg, CDialog)
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_MESSAGE(WM_BUTTONPRESSED,ButtonPressed) ////do this
ON_WM_TIMER()
END_MESSAGE_MAP()
 
BOOL Mylg::OnInitDialog()
{
CDialog::OnInitDialog();
SetIcon(m_hIcon, TRUE);			// Set big icon
m_cTab.Init();
m_cTab.InsertItem(0,"Register new user");
m_cTab.InsertItem(1,"Identify fingerprints");
m_cTab.CreateButton("Register User",24,0,0,520, 450,80);
return TRUE;  // return TRUE  unless you set the focus to a control
}
LRESULT MyDlg::ButtonPressed(WPARAM w, LPARAM l)////do this
{
int a=3,b=6,c;
c=a+b;
return 0;
}
 
void MyDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_TAB1, m_cTab);
}
 
MyTabCtrl .h
class MyTabCtrl : public CTabCtrl
{
	DECLARE_DYNAMIC(MyTabCtrl)
public:
	int m_DialogID,ControlID;;
	MyTabCtrl();
	virtual ~MyTabCtrl();
LRESULT ButtonPressed(WPARAM w, LPARAM l);	//mouse button clicked on a button control
void CreateButton(LPCTSTR sCaption, int nID, int iTab, UINT uLocation = 0, int iX = 0, int iY = 0, int iLen = 50);
 
MyTabCtrl .cpp
BEGIN_MESSAGE_MAP(MyTabCtrl, CTabCtrl)
	ON_MESSAGE(WM_BUTTONPRESSED,ButtonPressed)
	END_MESSAGE_MAP()
LRESULT MyTabCtrl::ButtonPressed(WPARAM w, LPARAM l)
{
	//to do
	return 0;
}
When I click the button "Register User" it run the code of MyTabCtrl::ButtonPressed(WPARAM w, LPARAM l) does not run MyDlg::ButtonPressed(WPARAM w, LPARAM l)
But I want to run of MyDlg::ButtonPressed(WPARAM w, LPARAM l)(How?)
Tags: VC++, MFC, VS2008

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).



Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 26 Mar 2009
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100