void Musiclist::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
if(nIDEvent==1)
{
if(x>245)
{
KillTimer(1);
SetTimer(3,50,NULL);return ;
}
x+=10;
if(hInst)
{
typedef BOOL (WINAPI *MYFUNC)(HWND,COLORREF,BYTE,DWORD);
MYFUNC fun = NULL;
fun=(MYFUNC)GetProcAddress(hInst, "SetLayeredWindowAttributes");//取得SetLayeredWindowAttributes函数指针
if(fun)fun(this->GetSafeHwnd(),0,x,2);
FreeLibrary(hInst);
}
} CDialog::OnTimer(nIDEvent);
}
{
// TODO: Add your message handler code here and/or call default
if(nIDEvent==1)
{
if(x>245)
{
KillTimer(1);
SetTimer(3,50,NULL);return ;
}
x+=10;
if(hInst)
{
typedef BOOL (WINAPI *MYFUNC)(HWND,COLORREF,BYTE,DWORD);
MYFUNC fun = NULL;
fun=(MYFUNC)GetProcAddress(hInst, "SetLayeredWindowAttributes");//取得SetLayeredWindowAttributes函数指针
if(fun)fun(this->GetSafeHwnd(),0,x,2);
FreeLibrary(hInst);
}
} CDialog::OnTimer(nIDEvent);
}
void Musiclist::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
if(nIDEvent==1)//表示编号为1的定时器
{
if(x>245)
{
KillTimer(1);//关闭定时器1
SetTimer(3,50,NULL);//在50微秒后,启动定时器3
return ;
}
x+=10; if(hInst)//加载的动态连接库句柄
{
typedef BOOL (WINAPI *MYFUNC)(HWND,COLORREF,BYTE,DWORD);
MYFUNC fun = NULL;
fun=(MYFUNC)GetProcAddress(hInst, "SetLayeredWindowAttributes");//取得SetLayeredWindowAttributes函数指针
if(fun)
fun(this->GetSafeHwnd(),0,x,2);//执行DLL中SetLayeredWindowAttributes函数
FreeLibrary(hInst);//释放句柄
}
} CDialog::OnTimer(nIDEvent);//默认的系统处理定时器
}
SetTimer()是由爆破人员将导火索点着的那一刻,点着以后导火索要烧一段时间,不能马上爆炸(马上就炸不是把点火的人炸死了?),比方延时5分钟。
5分钟到了以后OnTimer()就是炸弹。轰!!!!该干啥干啥吧。时间到了以后需要干的活都在OnTimer()里面。