晶
晶凌
Unregistered / Unconfirmed
GUEST, unregistred user!
Function TForm1.ActiveHandle : Integer;
begin
result := 0;
if( Assigned(ActiveControl)) then
try
result := ActiveControl.Handle
except
end;
end;
Procedure TForm1.SetMenuStates( const Enabled : Boolean );
begin
CanUndo;
Cut1.Enabled := Enabled;
Copy1.Enabled := Enabled;
Paste1.Enabled := Enabled;
end;
procedure TForm1.Edit1Click(Sender: TObject);
begin
SetMenuStates( ActiveHandle <> 0 );
end;
procedure TForm1.Undo1Click(Sender: TObject);
begin
SendMessage( ActiveHandle, WM_UNDO, 0, 0 );
CanUndo;
end;
procedure TForm1.Cut1Click(Sender: TObject);
begin
SendMessage( ActiveHandle, WM_CUT, 0, 0 );
CanUndo;
end;
procedure TForm1.Copy1Click(Sender: TObject);
begin
SendMessage( ActiveHandle, WM_COPY, 0, 0 );
CanUndo;
end;
procedure TForm1.Paste1Click(Sender: TObject);
begin
SendMessage( ActiveHandle, WM_PASTE, 0, 0 );
CanUndo;
end;
procedure TForm1.CanUndo;
begin
Undo1.Enabled := Boolean(SendMessage( ActiveHandle, EM_CANUNDO, 0, 0 ));
end;
运行后提示说没有声明activehandle,canundo,setmenustates,
undeclared identifier 'activehandle'
undeclared identifier 'canundo'
和could not complie used unit 'Unite1.pas'
修改了半天也没弄好,多谢大家帮忙,呵呵。
begin
result := 0;
if( Assigned(ActiveControl)) then
try
result := ActiveControl.Handle
except
end;
end;
Procedure TForm1.SetMenuStates( const Enabled : Boolean );
begin
CanUndo;
Cut1.Enabled := Enabled;
Copy1.Enabled := Enabled;
Paste1.Enabled := Enabled;
end;
procedure TForm1.Edit1Click(Sender: TObject);
begin
SetMenuStates( ActiveHandle <> 0 );
end;
procedure TForm1.Undo1Click(Sender: TObject);
begin
SendMessage( ActiveHandle, WM_UNDO, 0, 0 );
CanUndo;
end;
procedure TForm1.Cut1Click(Sender: TObject);
begin
SendMessage( ActiveHandle, WM_CUT, 0, 0 );
CanUndo;
end;
procedure TForm1.Copy1Click(Sender: TObject);
begin
SendMessage( ActiveHandle, WM_COPY, 0, 0 );
CanUndo;
end;
procedure TForm1.Paste1Click(Sender: TObject);
begin
SendMessage( ActiveHandle, WM_PASTE, 0, 0 );
CanUndo;
end;
procedure TForm1.CanUndo;
begin
Undo1.Enabled := Boolean(SendMessage( ActiveHandle, EM_CANUNDO, 0, 0 ));
end;
运行后提示说没有声明activehandle,canundo,setmenustates,
undeclared identifier 'activehandle'
undeclared identifier 'canundo'
和could not complie used unit 'Unite1.pas'
修改了半天也没弄好,多谢大家帮忙,呵呵。