void CMainFrame::OnDbclicked() //"双击标题条"菜单命令
{
// TODO: Add your command handler code here
POINT lpPoint;
CRect rect;
CWnd *pParent=AfxGetApp()->GetMainWnd();//获取主窗口指针
pParent->GetWindowRect(&rect);//获取主窗口的区域
lpPoint.x=rect.left+60;
lpPoint.y=rect.top+10;
SetCursorPos(lpPoint.x,lpPoint.y);//将鼠标的位置移动到标题条上
Sleep(1000);//等待1s
//双击标题条
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
}
void CMainFrame::OnLclick() //“单击关闭按钮"菜单命令
{
// TODO: Add your command handler code here
POINT lpPoint;
CRect rect;
CWnd *pParent=AfxGetApp()->GetMainWnd();//获取主窗口指针
pParent->GetWindowRect(&rect);
lpPoint.x=rect.right-10;
lpPoint.y=rect.top+5;
SetCursorPos(lpPoint.x,lpPoint.y);//将鼠标的位置移动到关闭按钮上
Sleep(1000);//等待1s
//单击关闭按钮
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
}