void CALLBACK 함수명(HWND hWnd, UINT nID, UINT nEl, DWORD time) { //구현부분 }
Callback 함수의 원형으로 해당 형태의 함수명를 Settime의 3번째 인자로 넣어주면
지정한 시간마다 해당 함수가 호출된다
void CALLBACK time2(HWND hWnd, UINT nID, UINT nEl, DWORD time) { CWnd* m_pWnd = AfxGetMainWnd(); CTimer_CheckDlg* m_pParent = (CTimer_CheckDlg*)m_pWnd; m_pParent->m_pro1.StepIt(); m_pParent->m_pro2.StepIt(); m_pParent->m_pro3.StepIt(); } void CALLBACK time1(HWND hWnd, UINT nID, UINT nEl, DWORD time) { CWnd* m_pWnd = AfxGetMainWnd(); CTimer_CheckDlg* m_pParent = (CTimer_CheckDlg*)m_pWnd; CString time_edit; time_edit.Format("1번 TIME COUNT : %d",m_pParent->cnt++); m_pParent->m_edt = time_edit; m_pParent->UpdateData(FALSE); } BOOL CTimer_CheckDlg::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 dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon cnt = 0; SetTimer(1,1000,time1); SetTimer(2,1000,time2); m_pro1.SetRange(0,1000); m_pro2.SetRange(0,2000); m_pro3.SetRange(0,3000); return TRUE; // return TRUE unless you set the focus to a control }
'MFC > Microsoft Foundation Class' 카테고리의 다른 글
[MFC] 가변인수 - va_list (0) | 2011.02.07 |
---|---|
[MFC] SENDMESSAGE 로 문자열 보내기 (0) | 2011.02.07 |
Formview전환시 사용되는 함수들 (0) | 2011.01.19 |
#include의 <>와 ""의 비교 (0) | 2011.01.19 |
SDI(Single Document Interface)에서 DialogBar와 FormView를 사용한 컨트롤 (1) | 2011.01.17 |