首先 你可以在OnInitDialog里设置一个定时器CDialog::OnInitDialog();// Add "About..." menu item to system menu.// IDM_ABOUTBOX must be in the system command range.ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);ASSERT(IDM_ABOUTBOX < 0xF000);CMenu* pSysMenu = GetSystemMenu(FALSE);if (pSysMenu != NULL){CString strAboutMenu;strAboutMenu.LoadString(IDS_ABOUTBOX);if (!strAboutMenu.IsEmpty()){pSysMenu->AppendMenu(MF_SEPARATOR);pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);}}// Set the icon for this dialog. The framework does this automatically// when the application's main window is not a dialogSetIcon(m_hIcon, TRUE); // Set big iconSetIcon(m_hIcon, FALSE); // Set small icon// TODO: Add extra initialization hereSetTimer(1,100,NULL);//时间设置短一点 显示的也快点return TRUE; // return TRUE unless you set the focus to a control然后为对话框添加WM_TIME消息void CAdcDlg::OnTimer(UINT nIDEvent) {// TODO: Add your message handler code here and/or call defaultPOINT pos;GetCursorPos(&pos); //取鼠标的坐标CString str;str.Format("%d,%d",pos.x,pos.y);m_dd=str;UpdateData(FALSE);CDialog::OnTimer(nIDEvent);}