dlgPage.Create(IDD_DLGPAGE,this);CRect rcDS;
dlgPage.GetWindowRect(&rcDS);
dlgPage.MoveWindow(0,
0,
rcDS.Width(),
rcDS.Height(),
FALSE);
dlgPage.parentHwnd=m_hWnd;
dlgPage.ShowWindow(SW_HIDE);窗体代码:
#define WM_MYPAGE (WM_USER+103)class CDlgPage : public CDialog
{
// Construction
public:
int i;
HWND hWnd;
HWND parentHwnd;
CDlgPage(CWnd* pParent = NULL); // standard constructor// Dialog Data
//{{AFX_DATA(CDlgPage)
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDlgPage)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL// Implementation
protected: // Generated message map functions
//{{AFX_MSG(CDlgPage)
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg void OnBtnpre();
afx_msg void OnBtnnext();
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CDlgPage::CDlgPage(CWnd* pParent /*=NULL*/)
{
//{{AFX_DATA_INIT(CDlgPage)
//}}AFX_DATA_INIT
}
void CDlgPage::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgPage)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgPage, CDialog)
//{{AFX_MSG_MAP(CDlgPage)
ON_WM_ERASEBKGND()
ON_BN_CLICKED(IDC_BTNPRE, OnBtnpre)
ON_BN_CLICKED(IDC_BTNNEXT, OnBtnnext)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
// CDlgPage message handlersvoid CDlgPage::OnBtnpre()
{
GetDlgItem(IDC_BTNNEXT)->EnableWindow(TRUE);
i++;
::SendMessage(parentHwnd,WM_MYPAGE,(long)-1,0);
}void CDlgPage::OnBtnnext()
{
::SendMessage(parentHwnd,WM_MYPAGE,(long)1,0);
i--;
if(i<=0)
{
GetDlgItem(IDC_BTNNEXT)->EnableWindow(FALSE);
i=0;
}
}BOOL CDlgPage::OnEraseBkgnd(CDC* pDC)
{
//return CWnd::OnEraseBkgnd(pDC);
return TRUE;
}BOOL CDlgPage::OnInitDialog()
{
CDialog::OnInitDialog();
i=0;
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
dlgPage.GetWindowRect(&rcDS);
dlgPage.MoveWindow(0,
0,
rcDS.Width(),
rcDS.Height(),
FALSE);
dlgPage.parentHwnd=m_hWnd;
dlgPage.ShowWindow(SW_HIDE);窗体代码:
#define WM_MYPAGE (WM_USER+103)class CDlgPage : public CDialog
{
// Construction
public:
int i;
HWND hWnd;
HWND parentHwnd;
CDlgPage(CWnd* pParent = NULL); // standard constructor// Dialog Data
//{{AFX_DATA(CDlgPage)
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDlgPage)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL// Implementation
protected: // Generated message map functions
//{{AFX_MSG(CDlgPage)
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg void OnBtnpre();
afx_msg void OnBtnnext();
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CDlgPage::CDlgPage(CWnd* pParent /*=NULL*/)
{
//{{AFX_DATA_INIT(CDlgPage)
//}}AFX_DATA_INIT
}
void CDlgPage::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgPage)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgPage, CDialog)
//{{AFX_MSG_MAP(CDlgPage)
ON_WM_ERASEBKGND()
ON_BN_CLICKED(IDC_BTNPRE, OnBtnpre)
ON_BN_CLICKED(IDC_BTNNEXT, OnBtnnext)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
// CDlgPage message handlersvoid CDlgPage::OnBtnpre()
{
GetDlgItem(IDC_BTNNEXT)->EnableWindow(TRUE);
i++;
::SendMessage(parentHwnd,WM_MYPAGE,(long)-1,0);
}void CDlgPage::OnBtnnext()
{
::SendMessage(parentHwnd,WM_MYPAGE,(long)1,0);
i--;
if(i<=0)
{
GetDlgItem(IDC_BTNNEXT)->EnableWindow(FALSE);
i=0;
}
}BOOL CDlgPage::OnEraseBkgnd(CDC* pDC)
{
//return CWnd::OnEraseBkgnd(pDC);
return TRUE;
}BOOL CDlgPage::OnInitDialog()
{
CDialog::OnInitDialog();
i=0;
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
解决方案 »
- 你们用C++语言的公司,都是用的是哪个版本的开发工具
- CProgress Bar 进度条控件使用的问题
- vs2008 Unicode编码 读取的文本文件汉字乱码
- ActiveX注册成功, 但IE加载不上的原因有哪些
- 工作进程如何改变主进程中的数据
- 为什么ip地址要分为ABCDE五类?
- VC编绎问题(能正常运行,但单步跟踪却如下提示ntdll.dll: no matching symbolic information )
- 如果用GetDesktopWindow()作为DC参数在桌面绘图,我如何擦除我绘的东西呢?
- 在WM_TIMER消息中出现异常,大神指点
- 关于extern!!!!
- 分析 multipart/form-data 的数据,有人会么?
- 除了TextOut和DrawText还有什么Api可以显示文字?
dlgPage.GetWindowRect(&rcDS);
dlgPage.MoveWindow(0,
0,
rcDS.Width(),
rcDS.Height(),
FALSE);
dlgPage.parentHwnd=m_hWnd;
dlgPage.ShowWindow(SW_HIDE);是不是要用指针啊~~?~?~?~?~?~?~??~?