各位大虾,大家好啊。俺弄这个东西弄了好几个天数了,可是还是没搞定。俺想弄一个类似QQ宠物的那样的喂养菜单出来。试过用Ontimer和OnMouseMone了,都不行。俺是想在鼠标进入到一个对话框的时候,然后出现第二个对话框。鼠标离开后那个对话框就自动关闭或者消失。但是用dlg.DoModal(),出现后鼠标离开就没反应了。下面是代码:
//处理鼠标移动消息,鼠标进入bar内
void CQuickBarDlg::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default CRect Mrect;
CFunDLG dlg;
GetWindowRect(&Mrect); //鼠标进入bar
if (!m_MOverControl||GetCapture()!=this)
{
m_MOverControl=true;
dlg.Create(IDD_FUNDLG);
dlg.ShowWindow(SW_SHOWNORMAL);
SetCapture();
}
else
{
//鼠标离开
if (!Mrect.PtInRect(point))
{
m_MOverControl=false;
ReleaseCapture();
}
} CDialog::OnMouseMove(nFlags, point);
}
//处理鼠标移动消息,鼠标进入bar内
void CQuickBarDlg::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default CRect Mrect;
CFunDLG dlg;
GetWindowRect(&Mrect); //鼠标进入bar
if (!m_MOverControl||GetCapture()!=this)
{
m_MOverControl=true;
dlg.Create(IDD_FUNDLG);
dlg.ShowWindow(SW_SHOWNORMAL);
SetCapture();
}
else
{
//鼠标离开
if (!Mrect.PtInRect(point))
{
m_MOverControl=false;
ReleaseCapture();
}
} CDialog::OnMouseMove(nFlags, point);
}
解决方案 »
- C++ 如何将Excel xlsm , xlsx格式保存为xls呢?反过来如何保存呢?
- Office有基于VC的类似MSDN的开发帮助文档吗?
- 请教 字符串类型匹配的问题
- 我的计时器怎么不工作?
- 钩子太短,请高手加长!
- WM_PAINT的奇怪现象
- installshild 中如何实现安装的时候拷贝整个目录的内容
- 问简单的字符串和字符数组的转换问题,头晕脑胀,请朋友们帮忙清醒一下!
- 能在线程中更改一个对话框中的数据吗??请高手指点一二。。。
- 求助关于图标的问题
- CString 二维数组的清空异常
- 请问Hook中的KeyboardProc的参数用法!int nCode这个究竟怎么用?顺便帮我看看我的这个Hook函数怎么会提示两次?
这样就不闪了。
闪是因为不停的
dlg.Create(IDD_FUNDLG);
dlg.ShowWindow(SW_SHOWNORMAL);具体的功能自己实现吧void CQQDlg::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CRect rect;
GetClientRect( &rect );
if ( rect.PtInRect( point ) || GetCapture() != this )
{
SetCapture();
if ( !m_dlg.m_hWnd )
{
m_dlg.Create( IDD_NEWDLG );
m_dlg.ShowWindow( SW_SHOW );
} }
else
{
ReleaseCapture();
if ( m_dlg.m_hWnd )
{
m_dlg.ShowWindow( SW_HIDE );
m_dlg.DestroyWindow();
}
}
CDialog::OnMouseMove(nFlags, point);
}
{
if(m_MOverControl==false){
m_MOverControl=true;
dlg.Create(IDD_FUNDLG);
dlg.ShowWindow(SW_SHOWNORMAL);
SetCapture();
}
}
不行么?
如果设断点的话,他还是在一直构造?
这个都没判断的说
if(m_MOverControl==false判断是否有效
也就是是否反复执行这里面的内容?