#include ".\HelloApp.h"
#include <afxwin.h>//declare the application classconst int IDC_BUTTON = 100;
const UINT IDT_TIME1 = 200;class CHelloApp:public CWinApp
{
public:
     virtual BOOL InitInstance();
 CHelloApp();};
//declare the main window class
class CHelloWindow:public CFrameWnd
{
private:   CButton *button;public:
   CHelloWindow();
   afx_msg void HandleButton();
   afx_msg void OnSize(UINT nType,int cx,int cy);
   afx_msg void OnTime(UINT id);
   afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
   DECLARE_MESSAGE_MAP();
}; 
BEGIN_MESSAGE_MAP(CHelloWindow,CFrameWnd)
ON_WM_SIZE()
ON_WM_TIMER()
ON_WM_CREATE()
ON_BN_CLICKED(IDC_BUTTON,HandleButton)
END_MESSAGE_MAP()//create an instanceof the window class
CHelloApp HelloApp;CHelloApp::CHelloApp()
{
//
}
//the application first executes
BOOL CHelloApp::InitInstance()
{

   this->m_pMainWnd = new CHelloWindow();
   this->m_pMainWnd->ShowWindow(this->m_nCmdShow);
   this->m_pMainWnd->UpdateWindow();
   return true;
  
}
//the constructor for window class
CHelloWindow::CHelloWindow()
{
   //create the window itself
   Create(NULL,"Hello World !",WS_OVERLAPPEDWINDOW,CRect(150,150,600,500));
   //if(this)
   {
       //MoveWindow(CRect(150,150,600,500),false);
   }
   this->UpdateWindow();
      CRect r;
   this->GetClientRect(&r);
   r.InflateRect(-20,-20);   button = new CButton();
   this->GetClientRect(&r);
   r.InflateRect(-20,-30);
   button->Create("Push",WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,r,this,IDC_BUTTON);   //this->SetTimer(IDT_TIME1,1000,NULL);
    
}void CHelloWindow::HandleButton()
{
//
}
void CHelloWindow::OnSize(UINT nType,int cx,int cy)
{
CRect r;
GetClientRect(&r);
r.InflateRect(-20,-30); 
//button->MoveWindow(r,true);
if(button)
{
button->MoveWindow(r,false);
}

}void CHelloWindow::OnTime(UINT id)
{

this->SetWindowText("sssssssssssssssss"  );
}int CHelloWindow::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
   SetTimer(IDT_TIME1,1000,NULL);
   return 0;
}
问题 :
1. 上面的时钟没有运行
2.  主窗口的构造函数中调用 MoveWindow(CRect(150,150,600,500),false);CHelloWindow::CHelloWindow()
{
   //create the window itself
   Create(NULL,"Hello World !",WS_OVERLAPPEDWINDOW,CRect(150,150,600,500));
   //if(this)
   {
       //MoveWindow(CRect(150,150,600,500),false);
   }为什么会导致  
if(button)
{
button->MoveWindow(r,false);
}
这里出现错误