//在OnInitDialog()中添加菜单
pSysMenu->InsertMenu(MF_STRING,0,ID_TOP_MOST_SHOW, "总在最上面(&T)")
void CXXXDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID &0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout
dlgAbout.DoModal()
}
else if(nID == ID_TOP_MOST_SHOW)
{
UpdateData()
m_bTopMost=!m_bTopMost
if(m_bTopMost)
this->SetWindowPos(&CWnd::wndTopMost,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE)//置顶
else
this->SetWindowPos(&CWnd::wndNoTopMost,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE)//不置顶
CMenu* pSysMenu = GetSystemMenu(FALSE)
if(pSysMenu!=NULL)
{
HMENU menu=pSysMenu->GetSafeHmenu()
if(m_bTopMost)
::CheckMenuItem(menu,ID_TOP_MOST_SHOW,MF_CHECKED)//菜单勾上
else
::CheckMenuItem(menu,ID_TOP_MOST_SHOW,MF_UNCHECKED)//
}
}
}
::SetWindowPos(m_hWnd, HWND_TOPMOST, 0, 0, 0, 0,SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE)//窗口置顶函数
颜色动态变化 设计一迅乱个消祥定时器 定时改变背景颜色拿昌搏呗
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)