上次,是在全屏后,按ESC后就退出全屏,现在效果是:有时候能截获到ESC,有时候不能
-----------------------------------------------
现在,想在全屏后,双击鼠标就退出,发现截获不到鼠标的双击消息-----------------------------------
给出部分代码如下:
void CFullDrawWnd::ShowFullScreen()
{
//为了调试暂时注销 5.9
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE,true,NULL,SPIF_SENDCHANGE);//3.17
ShowWindow(SW_SHOW);
//EnableTrayBar(FALSE);//5.9
//SetForegroundWindow();
SetActiveWindow();//这个也是
//this->SetWindowPos(&wndTopMost ,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE |SWP_SHOWWINDOW);
this->SetFocus();
}
=======================================================
BOOL CFullDrawWnd::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message==WM_KEYDOWN&&pMsg->wParam==VK_ESCAPE)
{
m_cbmp.Detach();
m_cbmp.DeleteObject();
m_brush.DeleteObject();
DestroyDlg();
//this->OnKillFocus(m_pParentWnd);
m_pParentWnd->PostMessage(SM_RECEIVED,0,0);
return TRUE;
}
return CWnd::PreTranslateMessage(pMsg);
}
==========================================================
void CFullDrawWnd::OnLButtonDblClk(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_cbmp.Detach();
m_cbmp.DeleteObject();
m_brush.DeleteObject();
DestroyDlg();//退出
//this->OnKillFocus(m_pParentWnd);//这个函数加不加,感觉没有作用
m_pParentWnd->PostMessage(SM_RECEIVED,0,0);
//CDialog::OnLButtonDblClk(nFlags, point);
}
============================
说明:
m_pParentWnd:为产生全屏窗口的父窗口
SM_RECEIVED:退出全屏消息 函数在父窗口中
-----------------------------------------------
现在,想在全屏后,双击鼠标就退出,发现截获不到鼠标的双击消息-----------------------------------
给出部分代码如下:
void CFullDrawWnd::ShowFullScreen()
{
//为了调试暂时注销 5.9
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE,true,NULL,SPIF_SENDCHANGE);//3.17
ShowWindow(SW_SHOW);
//EnableTrayBar(FALSE);//5.9
//SetForegroundWindow();
SetActiveWindow();//这个也是
//this->SetWindowPos(&wndTopMost ,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE |SWP_SHOWWINDOW);
this->SetFocus();
}
=======================================================
BOOL CFullDrawWnd::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message==WM_KEYDOWN&&pMsg->wParam==VK_ESCAPE)
{
m_cbmp.Detach();
m_cbmp.DeleteObject();
m_brush.DeleteObject();
DestroyDlg();
//this->OnKillFocus(m_pParentWnd);
m_pParentWnd->PostMessage(SM_RECEIVED,0,0);
return TRUE;
}
return CWnd::PreTranslateMessage(pMsg);
}
==========================================================
void CFullDrawWnd::OnLButtonDblClk(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_cbmp.Detach();
m_cbmp.DeleteObject();
m_brush.DeleteObject();
DestroyDlg();//退出
//this->OnKillFocus(m_pParentWnd);//这个函数加不加,感觉没有作用
m_pParentWnd->PostMessage(SM_RECEIVED,0,0);
//CDialog::OnLButtonDblClk(nFlags, point);
}
============================
说明:
m_pParentWnd:为产生全屏窗口的父窗口
SM_RECEIVED:退出全屏消息 函数在父窗口中
//this->OnKillFocus(m_pParentWnd);
m_pParentWnd->PostMessage(SM_RECEIVED,0,0);
DestroyDlg会产生不少的消息,将postmessage提前。2。你先确定是不能获取双击消息还是不能双击退出全屏。
感觉是后者,你获取了双击消息,但是没有退出全屏,而你误以为没有获取双击消息
好象不行代码如下:
BOOL CFullDrawWnd::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message==WM_KEYDOWN&&pMsg->wParam==VK_ESCAPE)
{
m_cbmp.Detach();
m_cbmp.DeleteObject();
m_brush.DeleteObject();
DestroyDlg();
//this->OnKillFocus(m_pParentWnd);
m_pParentWnd->PostMessage(SM_RECEIVED,0,0);
return TRUE;
}
else
{
if(pMsg->message==WM_LBUTTONDBLCLK)
{
m_cbmp.Detach();
m_cbmp.DeleteObject();
m_brush.DeleteObject();
DestroyDlg();
//this->OnKillFocus(m_pParentWnd);
m_pParentWnd->PostMessage(SM_RECEIVED,0,0);
return TRUE;
}
}
return CWnd::PreTranslateMessage(pMsg);
}跟踪都不能都这一步
2. if(pMsg->message==WM_LBUTTONDBLCLK)
{
AfxMessageBox("测试双击是不是响应");
}
我现在还没有搞明白
1.你是接收不到双击消息,
2.还是ShowFullScreen函数全屏窗口无效?
如果能往下看~~刚查了一下msdn
Only windows that have the CS_DBLCLKS style can receive WM_LBUTTONDBLCLK messages, which the system generates whenever the user presses, releases, and again presses the left mouse button within the system's double-click time limit.难道是你的窗口没有CS_DBLCLKS属性?
你给窗口添加CS_DBLCLKS 属性试一试
AfxRegisterWndClass(WS_EX_TOOLWINDOW,
AfxGetApp()->LoadStandardCursor(IDC_ARROW),
(HBRUSH)m_brush.GetSafeHandle()),
"杨睿的旋转字体",
WS_VISIBLE |WS_POPUP,
0,
0,
x,
y,
pParentWnd->GetSafeHwnd(),
NULL);
还真的没有这个我先试试多谢多谢