B
baoling
Unregistered / Unconfirmed
GUEST, unregistred user!
想做一个能够感知剪贴板动作的Memo控件,可是把该控件拖到Form上时,老是
提示"control '' has no parent window",这是为什么?
代码如下:
type
TJDQMemo = class(TMemo)
private
NextClipHwnd: HWND;
procedure WMDrawClipBoard(var AMessage: TMessage); message WM_DRAWCLIPBOARD;
protected
public
constructor Create(AOwner: TComponent); override; //构建
destructor Destroy; override;
published
end;
procedure Register;
implementation
constructor TJDQMemo.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
NextClipHwnd := SetClipBoardViewer(Handle);
end;
destructor TJDQMemo.Destroy;
begin
ChangeClipboardChain(Handle, NextClipHwnd);
SendMessage(NextClipHwnd, WM_CHANGECBCHAIN, Handle, NextClipHwnd);
inherited Destroy;
end;
procedure TJDQMemo.WMDrawClipBoard(var AMessage: TMessage);
var
s: string;
begin
......
......
end;
提示"control '' has no parent window",这是为什么?
代码如下:
type
TJDQMemo = class(TMemo)
private
NextClipHwnd: HWND;
procedure WMDrawClipBoard(var AMessage: TMessage); message WM_DRAWCLIPBOARD;
protected
public
constructor Create(AOwner: TComponent); override; //构建
destructor Destroy; override;
published
end;
procedure Register;
implementation
constructor TJDQMemo.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
NextClipHwnd := SetClipBoardViewer(Handle);
end;
destructor TJDQMemo.Destroy;
begin
ChangeClipboardChain(Handle, NextClipHwnd);
SendMessage(NextClipHwnd, WM_CHANGECBCHAIN, Handle, NextClipHwnd);
inherited Destroy;
end;
procedure TJDQMemo.WMDrawClipBoard(var AMessage: TMessage);
var
s: string;
begin
......
......
end;