我动态创建一个button控件
CRect rectWnd;
GetWindowRect(rectWnd);
SetWindowPos(NULL, 0, 0,
rectWnd.Width(),
rectWnd.Height(),
SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); m_button.CreateEx( WS_EX_CLIENTEDGE, _T("BUTTON"), NULL,
WS_CHILD | WS_VISIBLE|WS_TABSTOP| WS_BORDER , //
rectWnd.Width()/4-10, rectWnd.Height()-53, 80, 24, m_hWnd, 0, 0 );
m_button.SetWindowText("相关资料");
m_button.SetFont( GetFont() ); CenterWindow();
//在头文件里
#define IDC_BUTTON3001 3001afx_msg void OnButton();
//.cpp文件
ON_BN_CLICKED(IDC_BUTTON3001, OnButton)void CClPropertySheet::OnButton()
{
int i;
i=i+1;
}运行后这么点击button 也不运行到OnButton()里
我设断点,请问我这方法对不对?应该这样?
CRect rectWnd;
GetWindowRect(rectWnd);
SetWindowPos(NULL, 0, 0,
rectWnd.Width(),
rectWnd.Height(),
SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); m_button.CreateEx( WS_EX_CLIENTEDGE, _T("BUTTON"), NULL,
WS_CHILD | WS_VISIBLE|WS_TABSTOP| WS_BORDER , //
rectWnd.Width()/4-10, rectWnd.Height()-53, 80, 24, m_hWnd, 0, 0 );
m_button.SetWindowText("相关资料");
m_button.SetFont( GetFont() ); CenterWindow();
//在头文件里
#define IDC_BUTTON3001 3001afx_msg void OnButton();
//.cpp文件
ON_BN_CLICKED(IDC_BUTTON3001, OnButton)void CClPropertySheet::OnButton()
{
int i;
i=i+1;
}运行后这么点击button 也不运行到OnButton()里
我设断点,请问我这方法对不对?应该这样?
解决方案 »
- 问一个关于CListCtrl 的问题 在线等~!
- Edit对话框显示连续变化
- 求助,问个combobox的问题,查了好半天么找到答案
- 关于 #define WINVER 0x0500
- 怎么取消ACTIVE控件?
- 关于sql server的图像存储急!!!!
- 怎么样添加一个新类,从CDialogBar继承。
- float Rectangle::Area(void) const中的const有何用途?
- ATL中为什么不支持GlobalAllocPtr(GHND, m_EventBufSize)
- 怎样使CScrollView响应滚轮鼠标的滚轮
- ___W2K服务程序中如何模拟按键___
- 关于CPropertySheet和CProPertyPage的问题!
m_button.CreateEx( WS_EX_CLIENTEDGE, _T("BUTTON"), NULL,
WS_CHILD | WS_VISIBLE|WS_TABSTOP| WS_BORDER , //
rectWnd.Width()/4-10, rectWnd.Height()-53, 80, 24, m_hWnd, IDC_BUTTON3001 );