Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

@sglienke 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