如何再屏蔽掉原有的信息?
已经实现了右键,只是如何再屏蔽window弹出的那个: 剪切,复制,粘贴,的菜单
unit ComboBoxEC;
interface
uses
Windows, Messages, SysUtils, Classes, Controls, StdCtrls;
type
TComboBoxEC = class(TComboBox)
private
{ Private declarations }
FOnEditContextPopup: TContextPopupEvent;
protected
{ Protected declarations }
procedure ComboWndProc(var Message: TMessage; ComboWnd: HWnd;
ComboProc: Pointer); override;
procedure DoEditContextPopup(MousePos: TPoint; var Handled: Boolean); dynamic;
public
{ Public declarations }
published
{ Published declarations }
property OnEditContextPopup: TContextPopupEvent read FOnEditContextPopup write FOnEditContextPopup;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Samples', [TComboBoxEC]);
end;
{ TComboBoxEC }
procedure TComboBoxEC.ComboWndProc(var Message: TMessage; ComboWnd: HWnd;
ComboProc: Pointer);
var
hEdit: HWND;
Pt, Temp: TPoint;
Handled: Boolean;
msg: TWMContextMenu;
begin
Handled := False;
if (Style in [csDropDown, csSimple]) then hEdit := FindWindowEx(Handle, 0, 'Edit', nil)
else Exit;
if (ComboWnd = hEdit) and (Message.Msg = WM_CONTEXTMENU) then
begin
msg := TWMContextMenu(Message);
Pt := SmallPointToPoint(msg.Pos);
if InvalidPoint(Pt) then
Temp := Pt
else
begin
Temp := ScreenToClient(Pt);
if not PtInRect(ClientRect, Temp) then
begin
inherited;
Exit;
end;
end;
DoEditContextPopup(Temp, Handled);
end;
if not Handled then
inherited ComboWndProc(Message, ComboWnd, ComboProc);
end;
procedure TComboBoxEC.DoEditContextPopup(MousePos: TPoint;
var Handled: Boolean);
begin
if Assigned(FOnEditContextPopup) then FOnEditContextPopup(Self, MousePos, Handled);
end;
end.