如何让BUTTON在按下的状态下持续触发BN_CLICKED事件,回帖有分 开发环境:VS2008 + VC + MFC如何让BUTTON在按下的状态下持续触发BN_CLICKED事件,除了使用定时器,还有什么方法? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 while(){........Sleep()}可以吗 PreTranslateMessage(MSG* pMsg)WM_LBUTTONDOWNWM_LBUTTONUPexample:if (pMsg->message == WM_LBUTTONDOWN){......} 你重新CButton类,处理WM_LBUTTONDOWN/WM_LBUTTONUP消息不是更好? 监听MouseUp消息,只要没有就继续你的down WM_LBUTTONDOWNWM_LBUTTONUP void CMyButton::OnLButtonDown(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default SetTimer(1,100,0); CButton::OnLButtonDown(nFlags, point);}void CMyButton::OnLButtonUp(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default KillTimer(1); CButton::OnLButtonUp(nFlags, point);}void CMyButton::OnTimer(UINT nIDEvent) { // TODO: Add your message handler code here and/or call default if(GetKeyState(VK_LBUTTON) & 0x8000) { GetParent()->SendMessage(WM_COMMAND,BN_CLICKED << 16 | GetDlgCtrlID()); } CButton::OnTimer(nIDEvent);}不通过定时器会死循环! 如何修改硬盘分区号? opengl 问题求助,急 ado方法从SQLSERVER转为ORACLE的问题 关于MFC调试的结果分析 C++写个HTML解析器,大家给点思路............ 有谁知道vc的runtime library ... 多线程操作数据库(ado)问题 繁体版软件出现乱码? 用MFC做个小东西: 哪位有现成的有关保存Bitmap位图文件的例子可以选择Color位数? StringTable多语言在64位系统下选择语言 DropDown风格的Combo控件怎么获得控件ID?
{
........
Sleep()
}
可以吗
WM_LBUTTONUPexample:if (pMsg->message == WM_LBUTTONDOWN)
{
......
}
WM_LBUTTONUP
{
// TODO: Add your message handler code here and/or call default
SetTimer(1,100,0);
CButton::OnLButtonDown(nFlags, point);
}void CMyButton::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
KillTimer(1);
CButton::OnLButtonUp(nFlags, point);
}void CMyButton::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
if(GetKeyState(VK_LBUTTON) & 0x8000)
{
GetParent()->SendMessage(WM_COMMAND,BN_CLICKED << 16 | GetDlgCtrlID());
}
CButton::OnTimer(nIDEvent);
}
不通过定时器会死循环!