본문 바로가기

개발관련/MFC

timer 사용하기

OnTimer(UINT nIDEvent)
{
    do();
}

The SetTimer method sets a timer on the clock.

Syntax

HRESULT SetTimer(
  QWORD  cnsWhen,
  void  *pvParam,
  DWORD*  pdwTimerId
);

Parameters

cnsWhen

[in]  Specifies the time at which the reader notifies the OnStatus callback, in 100-nanosecond units.

pvParam

[in]  Specifies a pointer to the timer context parameters that are returned in the OnStatus callback.

pdwTimerId

[out]  Pointer to a DWORD containing the timer identifier.

Return Values

If the method succeeds, it returns S_OK. If it fails, possible return codes include, but are not limited to, the values shown in the following table.

ex) SetTimer(0, 1000, NULL);


The KillTimer method cancels a timer that has been set on the clock.

Syntax

HRESULT KillTimer(
  DWORD  dwTimerId
);

Parameters

dwTimerId

[in]  DWORD containing the timer identifier.

Return Values

If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code.

ex) KillTimer(0);


참...간단도 하다..

OnTimer()에서 하고자 하는 동작 선언하고 SetTimer로 시간 셋팅하고 다 쓰면 KillTiemr로 죽여 버리고. ㅎ;;