本文主要是介绍mfc_vc++最小化或者离开当前窗口后在任务栏的消息提醒闪烁功能,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
mfc_vc++最小化或者离开当前窗口后任务栏消息提醒功能
代码放在OnTimer里面
void CMFCApplication1Dlg::OnTimer(UINT_PTR nIDEvent)
{// TODO: 在此添加消息处理程序代码和/或调用默认值//if(nIDEvent==100)//{/*if (this != GetForegroundWindow()){HWND hCurwnd = NULL;hCurwnd = ::GetForegroundWindow();DWORD threadID = ::GetCurrentThreadId();DWORD threadprocessid = ::GetWindowThreadProcessId(hCurwnd, &threadID);::AttachThreadInput(threadID, threadprocessid, TRUE);this->SetForegroundWindow();::AttachThreadInput(threadID, threadprocessid, FALSE);}*/if (nIDEvent == 100){if (::GetActiveWindow() == AfxGetMainWnd()->m_hWnd){//KillTimer(100); //当程序窗口置于最前时,停止闪烁}else{FlashWindow(TRUE);}}CDialogEx::OnTimer(nIDEvent);
}
这篇关于mfc_vc++最小化或者离开当前窗口后在任务栏的消息提醒闪烁功能的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!