基本上每个消息都有一个Result,代表是否(正确)处理过了(但是是否继续传递,还得研究)
2016-02-02 22:35
288 查看
先看消息的定义:
看这个函数,如果Result<>0,就代表处理过了,直接退出:
TWMContextMenu = packed record Msg: Cardinal; hWnd: HWND; case Integer of 0: ( XPos: Smallint; YPos: Smallint); 1: ( Pos: TSmallPoint; Result: Longint); end; TWMShowWindow = packed record Msg: Cardinal; Show: BOOL; Status: Longint; Result: Longint; end; TWMSize = packed record Msg: Cardinal; SizeType: Longint; { SIZE_MAXIMIZED, SIZE_MINIMIZED, SIZE_RESTORED, SIZE_MAXHIDE, SIZE_MAXSHOW } Width: Word; Height: Word; Result: Longint; end;
看这个函数,如果Result<>0,就代表处理过了,直接退出:
procedure TControl.WMContextMenu(var Message: TWMContextMenu); var Pt, Temp: TPoint; Handled: Boolean; PopupMenu: TPopupMenu; begin if Message.Result <> 0 then Exit; if csDesigning in ComponentState then begin inherited; Exit; end; Pt := SmallPointToPoint(Message.Pos); if InvalidPoint(Pt) then Temp := Pt else begin Temp := ScreenToClient(Pt); if not PtInRect(ClientRect, Temp) then begin inherited; Exit; end; end; Handled := False; DoContextPopup(Temp, Handled); Message.Result := Ord(Handled); if Handled then Exit; PopupMenu := GetPopupMenu; if (PopupMenu <> nil) and PopupMenu.AutoPopup then begin SendCancelMode(nil); PopupMenu.PopupComponent := Self; if InvalidPoint(Pt) then Pt := ClientToScreen(Point(0, 0)); PopupMenu.Popup(Pt.X, Pt.Y); Message.Result := 1; end; if Message.Result = 0 then inherited; end;
相关文章推荐
- CodeForces 603A Alternative Thinking(找规律)
- C语言编程获取PE文件File_Header内容
- CodeForces 621B Wet Shark and Bishops
- 为什么虚拟机里面的ubuntu不能共享windows的文件. /mnt/hgfs无效
- Codeforces 621B Wet Shark and Flowers
- CodeForces 552C Vanya and Scales(进制转化)
- Java中byte与16进制字符串的互换原理
- 第十一天
- CodeForces 621A Wet Shark and Odd and Even
- 事务复制-大批量DEL操作
- 记录遇到的Python陷阱和注意点
- 记一次面试经验
- android实现微信自动抢红包
- Hadoop 之 文件切分算法
- 《笨办法学Python》 第31课手记
- 【转】 Android的NDK开发(1)————Android JNI简介与调用流程
- 嵌入式Linux之旅——环境搭建篇之烧写裸机程序
- c++转换构造函数和类型转换函数
- CDOJ 1273 God Qing's circuital law
- Block使有注意点