S := FormatDateTime('hh/nn/ss', Now);
SendMessage(Memo1.Handle, EM_REPLACESEL, 1, LPARAM(PChar(S)));
unit HMemo;
interface
uses
Windows, Messages, SysUtils, Classes, Controls, StdCtrls;
type
THMemo = class(TMemo)
private
procedure SetSelText(const Value: string); reintroduce;
protected
{ Protected declarations }
public
procedure SetSelTextBuf(Buffer: PChar);
published
constructor Create(AOwner: TComponent); reintroduce;
property SelText read GetSelText write SetSelText;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('HAKGERSoft Components', [THMemo]);
end;
{ THMemo }
constructor THMemo.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
end;
procedure THMemo.SetSelText(const Value: string);
begin
SendMessage(Handle, EM_REPLACESEL, 1, Longint(PChar(Value)));
end;
procedure THMemo.SetSelTextBuf(Buffer: PChar);
begin
SendMessage(Handle, EM_REPLACESEL, 1, LongInt(Buffer));
end;
end.
procedure SetSelText(Edit: TCustomEdit; const S: String);
begin
SendMessage(Edit.Handle, EM_REPLACESEL, 1, LPARAM(PChar(S)));
end;
unit HMemo;
interface
uses
Windows, Messages, SysUtils, Classes, Controls, StdCtrls;
type
THMemo = class(TMemo)
private
procedure SetSelTextMy(const Value: string);
protected
{ Protected declarations }
public
procedure SetSelTextBuf(Buffer: PChar);
published
constructor Create(AOwner: TComponent); reintroduce;
property SelText read GetSelText write SetSelTextMy;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('HAKGERSoft Components', [THMemo]);
end;
{ THMemo }
constructor THMemo.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
end;
procedure THMemo.SetSelTextMy(const Value: string);
begin
SendMessage(Handle, EM_REPLACESEL, 1, Longint(PChar(Value)));
end;
procedure THMemo.SetSelTextBuf(Buffer: PChar);
begin
SendMessage(Handle, EM_REPLACESEL, 1, LongInt(Buffer));
end;
end.
Users browsing this forum: No registered users and 21 guests