二六、无title对话框的移动:
void CScreenSnapDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
//实现窗体无标题移动
PostMessage(WM_NCLBUTTONDOWN,HTCAPTION,MAKELPARAM(point.x,point.y));
CDialog::OnLButtonDown(nFlags, point);
}
二七、获取操作系统版本:
OSVERSIONINFO OsVersionInfo;//包含操作系统版本信息的数据结构
OsVersionInfo.dwOSVersionInfoSize= sizeof(OSVERSIONINFO);
GetVersionEx(&OsVersionInfo);//获取操作系统版本信息
二八、设置对话框为最顶层:(在OnInitDialog中添加)
SetWindowPos(&wndTopMost,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
二九、对话框程序不在任务栏显示:(在OnInitDialog中添加)
ModifyStyleEx(WS_EX_APPWINDOW,WS_EX_TOOLWINDOW);
三十、向对话框窗口添加右键菜单:
CMenu menu,*pmenu;
menu.LoadMenu(IDR_MENU1);
pmenu=menu.GetSubMenu(0);
CPoint ptScreen(point);
ClientToScreen(&ptScreen);
pmenu->TrackPopupMenu(TPM_RIGHTBUTTON,ptScreen.x,ptScreen.y,this);