CRect m_reLogin, rcExit;
m_Login.GetWindowRect(&m_reLogin);
m_exit.GetWindowRect(&rcExit);
CPoint point;
// 获取鼠标点
GetCursorPos(&point);
// 判断鼠标点是否在控件上
if (m_reLogin.PtInRect(point))
对于MFC 控件的使用,在系统函数BOOL CHRMDlg::PreTranslateMessage(MSG* pMsg)中添加控件功能,通过获取鼠标点坐标,然后判断是否在控件上,进而实现控件的逻辑功能;
关闭对话框:
CDialog::OnCancel();
GetDlgItem(IDC_EDIT_USER)->SetFocus(); (大致是用来设置焦点,但是具体用在什么地方还没搞懂)
在系统函数中void CHrmMainFODlg::OnLButtonDown(UINT nFlags, CPoint point)添加控件功能(例如button),需要将获得的鼠标点坐标转换成客户区坐标; ScreenToClient(rcExit);
void CHrmMainFODlg::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
CRect rcStafM, rcInsM, rchtM, rcDepartM, rcExit;
m_staffManage.GetWindowRect(&rcStafM);
ScreenToClient(rcStafM);
}
string 删除字符串中指定的字符,
// 过滤字符‘_’,使得与配置文件名中保持一致
processName.erase(std::remove(processName.begin(), processName.end(), '_'), processName.end());