Skip to content

Instantly share code, notes, and snippets.

@jpluimers
Created February 3, 2017 10:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpluimers/56e4ddcd9a8b200f8080ce0c8dcaba2f to your computer and use it in GitHub Desktop.
Save jpluimers/56e4ddcd9a8b200f8080ce0c8dcaba2f to your computer and use it in GitHub Desktop.
Disable the Delphi clipboard history; originally by Attila Kovacs at https://plus.google.com/u/0/108426155215159556558/posts/6MBZuMYDTCD
unit DisableClipboardHistoryFormUnit;
interface
procedure DisableClipboardHistoryForm;
implementation
uses
System.Classes,
Vcl.Menus,
ToolsAPI;
procedure DisableClipboardHistoryForm;
const
ClipboardHistoryForm = 'ClipboardHistoryForm';
var
i: Integer;
j: Integer;
mi: TMenuItem;
NTAServices: INTAServices;
o: TComponent;
begin
NTAServices := BorlandIDEServices as INTAServices;
for i := 0 to NTAServices.MainMenu.Items.Count - 1 do
begin
mi := NTAServices.MainMenu.Items[i];
for j := 0 to mi.Count - 1 do
begin
if Assigned(mi.Items[j].Action) and //
Assigned(mi.Items[j].Action.Owner) and //
(mi.Items[j].Action.Owner.Name = ClipboardHistoryForm) then
begin
mc := mi.Items[j];
mi.Remove(mc);
mc.Free;
o := Application.FindComponent(ClipboardHistoryForm);
if Assigned(o) then
o.Free;
Break;
end;
end;
end;
end;
end.
@sglienke
Copy link

sglienke commented Apr 9, 2018

local variable declaration for mc is missing (like mi also TMenuItem) and Vcl.Forms is missing from the uses (needed for Application)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment