一个基于对话框的程序,要实现:当按下某个按钮时,发送消息,而运行另外一个类的一个成员函数。可是当按下按钮时,为什么程序就没有反应啊?恳求大家帮忙,谢谢!谢谢!按下对话框的按钮运行的程序是:
void CClassMessThreadDlg::OnBUTTONTest()
{
// TODO: Add your control notification handler code here
HWND hDlg=(HWND)*this;
::PostMessage(hDlg,WM_StartTest,1,NULL);
}另外一个类的头文件是:
CaptureVideo.h
#define WM_StartTest WM_USER+1
//////////////////////////////////////////////////////////////////////////
class CCaptureVideo : public CWnd
{
// Construction
public:
CCaptureVideo();// Attributes
public:
// Operations
public:
void RunTest();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CCaptureVideo)
protected:
virtual void DoDataExchange(CDataExchange* pDX);
//}}AFX_VIRTUAL// Implementation
public:
virtual ~CCaptureVideo(); // Generated message map functions
protected:
//{{AFX_MSG(CCaptureVideo)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};另外一个类对应的.CPP文件是:
CaptureVideo.cpp内容是:
...
BEGIN_MESSAGE_MAP(CCaptureVideo, CWnd)
//{{AFX_MSG_MAP(CCaptureVideo)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
ON_MESSAGE(WM_StartTest,RunTest)
END_MESSAGE_MAP()
...
void CCaptureVideo::RunTest()
{
AfxMessageBox("RunTest函数开始运行 !");
}
void CClassMessThreadDlg::OnBUTTONTest()
{
// TODO: Add your control notification handler code here
HWND hDlg=(HWND)*this;
::PostMessage(hDlg,WM_StartTest,1,NULL);
}另外一个类的头文件是:
CaptureVideo.h
#define WM_StartTest WM_USER+1
//////////////////////////////////////////////////////////////////////////
class CCaptureVideo : public CWnd
{
// Construction
public:
CCaptureVideo();// Attributes
public:
// Operations
public:
void RunTest();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CCaptureVideo)
protected:
virtual void DoDataExchange(CDataExchange* pDX);
//}}AFX_VIRTUAL// Implementation
public:
virtual ~CCaptureVideo(); // Generated message map functions
protected:
//{{AFX_MSG(CCaptureVideo)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};另外一个类对应的.CPP文件是:
CaptureVideo.cpp内容是:
...
BEGIN_MESSAGE_MAP(CCaptureVideo, CWnd)
//{{AFX_MSG_MAP(CCaptureVideo)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
ON_MESSAGE(WM_StartTest,RunTest)
END_MESSAGE_MAP()
...
void CCaptureVideo::RunTest()
{
AfxMessageBox("RunTest函数开始运行 !");
}
解决方案 »
- 用C++的SQLConfigDataSource函数配置数据源针对db2数据库的问题
- 关于下拉列表内容的选取问题????
- 想用Word2007的RibbonComboBox/RibbonDropDown等类,不知道要#import那个类型库或者DLL
- OpenGL窗体中如何实现屏幕截图
- 各位高人,有一小问题请教,在VC中用ADO,调用存储过程,但是在濒繁的访问数据库的时候?老是调拥错处,为什么呀
- 100分,API编程的新手的一个入门问题!
- 现可以枚举出odbc数据源的名称和类别,问:如何得到该数据源的存储路径?
- TCP问题
- 我在写一篇《ADO开发手册》的文档,请有个人网站的同志帮我发布
- ----好久没来----祝新老朋友们假期快乐-----
- javascript中,如何得到IE刷新事件?
- 100分,怎么对另外一个程序的SysListView32的行进行光标定位
Post过来的消息,您没有处理啊!