delphi OnMouseLeave 事件不灵敏及解决之道(使用TrackMouseEvent函数进行加强)
http://topic.csdn.net/t/20020104/09/456913.html
CM_MouseLeave消息好象不太灵敏,当鼠标快速移出窗体时,就收不到这个消息,请问大家有什么好办法吗?
#1楼 得分:0回复于:2002-01-04 09:32:23
那就用上一级组件的CM_MouseEnter配合
#2楼 得分:0回复于:2002-01-04 11:05:35
移出窗体了,不行。
#3楼 得分:0回复于:2002-01-04 11:14:54
cm_mouseleave的确不太好用,应该用wm_mouseleave这个消息结合trackmouseevent这个api使用!绝对好用,呵呵,只不过比cm_mouseleave麻烦一点点了!
#4楼 得分:0回复于:2002-01-04 11:14:59
要SetCapture
#5楼 得分:0回复于:2002-01-04 11:17:54
使用wndpro函数
#6楼 得分:0回复于:2002-01-04 11:25:13
我正好有同样的问题,上面几位的意见都不一样,能不能说的详细一点。
#7楼 得分:0回复于:2002-01-04 11:31:08
wm_mouseleave是windows的消息,我测试过处理mouseleave绝对很不错,虽然必须结合trackmouseevent函数使用,不是很方便,但是效果嘛,最好!
#8楼 得分:0回复于:2002-01-05 21:44:56
好象不行,trackmouseevent是NT的函数。
我在98下试了试,没有反应。
#9楼 得分:0回复于:2002-01-06 15:12:19
不会呀,trackmouseevent虽然我没在98下测试,但是msdn上说了支持98,不要告诉我ms在骗我:)呵呵
Windows NT/2000: Requires Windows NT 4.0 or later.
Windows 95/98: Requires Windows 98 or later.
Header: Declared in Winuser.h; include Windows.h.
Library: Use User32.lib.
#10楼 得分:0回复于:2002-01-06 17:37:18
但我手边的DELPHI 5的WIN REFERENCE手册中trackmouseevent的QUICKINFO明确指出不支持。
浪人,能让我看看你的代码吗?我的代码如下:
procedure TForm1.Button1Click(Sender: TObject);
var
e: TagTRACKMOUSEeVENT;
begin
E.cbSize:= SIZEof(TagTRACKMOUSEeVENT);
E.dwFlags:= TME_LEAVE;
E.dwHoverTime:= 10;
E.hwndTrack:= handle;
trackmouseevent(e);
end;
procedure TForm1.WMMouseLeave(var M: TMessage);
begin
color:= clRed;
end;
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
color:= clBlue;
end;
不行。
#11楼 得分:0回复于:2002-01-06 19:23:53
明天给你一个例子
#12楼 得分:0回复于:2002-01-06 19:57:43
wm_mouseleave是windows的消息吗?瞎搞嘛!你说的是win64还是win32啊
#13楼 得分:0回复于:2002-01-06 19:58:54
.net中有这个消息啊
#14楼 得分:0回复于:2002-01-06 21:37:09
先谢了。
另外说一句,我刚试了用SetCapture的方法,但效果不好。
#15楼 得分:0回复于:2002-01-07 08:53:59
to ss(雅龙):
至于我是不是瞎搞,你把你的msdn换正版把,难道你的msdn和我的不一样,奇怪!WM_MOUSELEAVE到底是不是windows消息,我给你看看,我现在还用不上win64,不好意思:
下面是msdn拷贝,自己看看吧:
Platform SDK: Windows User Interface
WM_MOUSELEAVE
The WM_MOUSELEAVE message is posted to a window when the cursor leaves the client area of the window specified in a prior call to TrackMouseEvent.
A window receives this message through its WindowProc function.
LRESULT CALLBACK WindowProc(
HWND hwnd, // handle to window
UINT uMsg, // WM_MOUSELEAVE
WPARAM wParam, // not used
LPARAM lParam // not used
);
Parameters
This message has no parameters.
Return Values
If an application processes this message, it should return zero.
Remarks
All tracking requested by TrackMouseEvent is canceled when this message is generated. The application must call TrackMouseEvent when the mouse reenters its window if it requires further tracking of mouse hover behavior.
Requirements
Windows NT/2000: Requires Windows NT 4.0 or later.
Windows 95/98: Requires Windows 98 or later.
Header: Declared in Winuser.h; include Windows.h.
See Also
Mouse Input Overview, Mouse Input Messages, GetCapture, SetCapture, TrackMouseEvent, TRACKMOUSEEVENT, WM_NCMOUSELEAVE
Built on Thursday, October 12, 2000Requirements
Windows NT/2000: Requires Windows NT 4.0 or later.
Windows 95/98: Requires Windows 98 or later.
Header: Declared in Winuser.h; include Windows.h.
See Also
Mouse Input Overview, Mouse Input Messages, GetCapture, SetCapture, TrackMouseEvent, TRACKMOUSEEVENT, WM_NCMOUSELEAVE
#16楼 得分:40回复于:2002-01-07 08:56:28
to oldhawk(老鹰):上面贴一大堆东西,不好意思,因为我对他有点生气而已,呵呵
给你的代码,很简单,值得注意的就一点,TrackMouseEvent的调用在窗体的mousemove里面,good lucky!!!:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
private
{ Private declarations }
procedure MouseLeave(var Msg: TMessage); message WM_MOUSELEAVE;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var
xh: TTrackMouseEvent;
begin
xh.cbSize := sizeof(xh);
xh.dwFlags := TME_LEAVE;
xh.hwndTrack := Handle;
xh.dwHoverTime := 0;
TrackMouseEvent(xh);
end;
procedure TForm1.MouseLeave(var Msg: TMessage);
begin
Caption := Caption + '# ';
Msg.Result := 0;
end;
end.
#17楼 得分:0回复于:2002-01-07 12:03:54
浪人:
在我的WINDOWS98S上测了一下,十分灵敏,感激不尽!分都给你了。
后会有期!
http://www.cnblogs.com/-clq/archive/2012/09/21/2696367.html
delphi OnMouseLeave 事件不灵敏及解决之道(使用TrackMouseEvent函数进行加强)的更多相关文章
- Delphi 7事件的多处理机制
Delphi 7事件的多处理机制Allen Tao2007-08-19 首先解释一下这个题目.在我使用Delphi 7的过程中发现,一个对象的事件只能被一个过程处理.如果多次给这个对象的事件赋给处理事 ...
- delphi之事件
delphi的事件如上图所示: 图中oncloseup代表的是日期选择下拉框关闭时触发的事件. //事件定义 procedure Ondatechange(Sender: TObject); //事件 ...
- Delphi动态事件深入分析(对象方法在调用的时候会传递一个隐含的Self指针,而该指针的值在EAX中。即左边第一个参数)
Delphi动态事件深入分析 2009-2-7 作者:不得闲核心提示:本实验证明了在类中方法的调用时候,所有的方法都隐含了一个Self参数,并且该参数作为对象方法的第一个参数传递... 首先做一个空窗 ...
- WM_SYSCOMMAND包括很多功能,比如:拖动左边框、拖动标题栏、滚动条滚动、点击最小化、双击标题栏——Delphi 通过事件代替了大部分常用的消息,所以Delphi 简单、易用、高效
procedure TForm1.WMSysCommand(var Message: TWMSysCommand); var str: string; begin case Message.CmdTy ...
- jQuery绑定和解绑点击事件及重复绑定解决办法
原文地址:http://www.111cn.net/wy/jquery/47597.htm 绑点击事件这个是jquery一个常用的功能,如click,unbind等等这些事件绑定事情,但还有很多朋友不 ...
- 动态生成的DOM不会触发onclick事件的原因及解决方法
最近朋友在做一个项目的时候,遇到动态加载微博内容,然后点击“展开评论”后获取该微博的所有评论.这里使用了动态加载的<span mid='123456789′ class='get_comment ...
- WebBrowser 的 DocumentCompleted事件不执行的解决方法
原文:WebBrowser 的 DocumentCompleted事件不执行的解决方法 WebBrowser 的 DocumentCompleted事件不执行的解决方法: 使用WebBrowser的P ...
- delphi xe6 窗口 visible 不能隐藏 解决
delphi xe6 窗口 visible 不能隐藏 解决 在工程代码里面加上 Application.ShowMainForm := false;
- Delphi动态事件深入分析
[delphi] view plain copy print? 首先做一个窗体如下 然后单元中如下代码: 在implementation下面声明两个方法如下: //外部方法,只声明一个参数,此时按 ...
随机推荐
- Thread和Runnable差别
继承Thread类的,我们相当于拿出三件事即三个卖票10张的任务分别分给三个窗体,他们各做各的事各卖各的票各完毕各的任务.由于MyThread继承Thread类.所以在new MyThread的时候在 ...
- mysql 时区 , 夏令时,冬令时
mysql默认时区: mysql> show variables like '%time_zone%'; +------------------+--------+ | Variable_nam ...
- agentzh --春哥--调试专家
https://github.com/agentzh/perl-systemtap-toolkit https://github.com/openresty http://openresty.org/ ...
- systemTAP 学习
http://blog.csdn.net/moonvs2010/article/category/1570309
- Android 开发实践 ViewGroup 实现左右滑出窗口(一)
利用假期把以前做的东西总结整理一下,先从简单的开始吧.实现的效果是这样的: 做了个截屏动画,比例有点不对了,凑合着看吧. 整个窗口有3部分组成,中间的主界面是个列表,左边的滑出界面是个菜单,右边的 ...
- GitHub Desktop安装异常解决
为了更好的共同学习,共同进步,哥们推荐我使用GitHub记录自己每天的学习记录,当下很火的提供一个分布式的版本控制系统(Git)服务的网站,GitHub提供GitHub Desktop桌面程序方便协同 ...
- 在treeview外加一个滚动条的实现
前台代码: <div style="overflow:auto;width:190px;height:280px;border:1px solid #336699;padding-le ...
- Eclipse中看java源代码
如何在Eclipse sdk中查看jar源代码如:*.jar 1.点 “window”-> "Preferences" -> "Java" -> ...
- HDOJ 2036
错误代码: #include<stdio.h>#include<math.h>int main(){ int x[102],y[102]; int i,n; float s,a ...
- Fedora 18安装Google输入法和云拼音
由于sunpinyin的词库选词太不准,网友推荐在Fedora 18下使用谷歌拼音及云拼音,于是想要尝试下怎么样.由于fedora 源中谷歌拼音所以选择自行编译,做下记录以备份. #安装fcitx $ ...