16,473
社区成员
发帖
与我相关
我的任务
分享
BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message == WM_LBUTTONDOWN && pMsg->hwnd == m_wndStatusBar.GetSafeHwnd())
{
CRect rect;
CPoint pt;
pt = pMsg->pt;
m_wndStatusBar.GetItemRect(4,&rect);
m_wndStatusBar.ClientToScreen(&rect);
if(PtInRect(&rect,pt))
{
//Add your function
//AfxMessageBox("Date");
if (theApp.m_bIsAdmin=="1")
{
CDateDlg Dlg;
if (Dlg.DoModal()==IDOK)
{
CString tmpstr="当前处理时间:"+theApp.m_strOperDate;
m_wndStatusBar.SetPaneText(4,(LPCTSTR)tmpstr);
}
}
else
{
AfxMessageBox("管理员才能运行本模块!");
}
}
}
return CFrameWnd::PreTranslateMessage(pMsg);
}
return CFrameWnd::PreTranslateMessage(pMsg);
#ifdef _DEBUG
void CWnd::AssertValid() const
{
if (m_hWnd == NULL)
return; // null (unattached) windows are valid
// check for special wnd??? values
ASSERT(HWND_TOP == NULL); // same as desktop
if (m_hWnd == HWND_BOTTOM)
ASSERT(this == &CWnd::wndBottom);
else if (m_hWnd == HWND_TOPMOST)
ASSERT(this == &CWnd::wndTopMost);
else if (m_hWnd == HWND_NOTOPMOST)
ASSERT(this == &CWnd::wndNoTopMost);
else
{
// should be a normal window
ASSERT(::IsWindow(m_hWnd));
// should also be in the permanent or temporary handle map
CHandleMap* pMap = afxMapHWND();
ASSERT(pMap != NULL);
CObject* p;
ASSERT((p = pMap->LookupPermanent(m_hWnd)) != NULL ||
(p = pMap->LookupTemporary(m_hWnd)) != NULL);
ASSERT((CWnd*)p == this); // must be us
// Note: if either of the above asserts fire and you are
// writing a multithreaded application, it is likely that
// you have passed a C++ object from one thread to another
// and have used that object in a way that was not intended.
// (only simple inline wrapper functions should be used)
//
// In general, CWnd objects should be passed by HWND from
// one thread to another. The receiving thread can wrap
// the HWND with a CWnd object by using CWnd::FromHandle.
//
// It is dangerous to pass C++ objects from one thread to
// another, unless the objects are designed to be used in
// such a manner.
}
}