Created
February 3, 2017 10:19
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
local variable declaration for mc is missing (like mi also TMenuItem) and Vcl.Forms is missing from the uses (needed for Application)