您当前的位置: 首页 >  c++

txwtech

暂无认证

  • 4浏览

    0关注

    813博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

mfc_vc++最小化或者离开当前窗口后在任务栏的消息提醒闪烁功能

txwtech 发布时间:2021-09-12 14:42:38 ,浏览量:4

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);
}

关注
打赏
1665060526
查看更多评论
立即登录/注册

微信扫码登录

0.1157s