//前面還有一些畫風扇的代碼之類的
HANDLE hTimer ;
void CALLBACK TimerAPCProc(LPVOID lpArg, DWORD dwl, DWORD dw2 )
{
CWINDMILLDlg *timer =(CWINDMILLDlg *)lpArg;
timer->SendMessage(WM_TIMER, 0, 0);
}
void CWINDMILLDlg::OnBnClickedStart()
{
CRect rect1;
rect1.left = 500;
rect1.top = 200;
rect1.right = -250;
rect1.bottom= -200;
UpdateData(true);
LARGE_INTEGER li;
const int nTimerUnitsPerSecond = 10000000;
li.QuadPart = - (1 * nTimerUnitsPerSecond);
hTimer = CreateWaitableTimer(NULL, FALSE, NULL);
InvalidateRect(&rect1);
SetWaitableTimer(hTimer, &li, 0, TimerAPCProc,NULL , FALSE);
}
void CWINDMILLDlg::OnTimer(UINT_PTR nIDEvent)
{
// TODO: 在此添加訊息處理程式代碼和/或呼叫默認值
CRect rect1;
rect1.left = 500;
rect1.top = 200;
rect1.right = -250;
rect1.bottom= -200;
InvalidateRect(&rect1);
UpdateData(TRUE);
CDialogEx::OnTimer(nIDEvent);
}
我這個程式主要就是一個風扇轉動,然后我現在就不能自動轉動,點一下轉動一下。我不知道問題出在哪里了。。多媒體定時器感覺和這個思路差不多。。成功了。。但這個我怎么也想不出來。。嗚嗚求指教
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/15215.html
標籤:基礎類
