Disable the Delphi clipboard history; originally by Attila Kovacs at https://plus.google.com/u/0/108426155215159556558/posts/6MBZuMYDTCD
Posted by jpluimers on 2018/04/07
[WayBack] Castalia had a Clipboard History for Delphi since a long time and since the acquisition of it around Delphi XE8, that was [Archive.is] integrated into the IDE for everyone to use as the [WayBack] “Delphi Clipboard History”
Some people object to the history viewer, for instance:
- stability reasons
- security issues
Even though used by a lot of password managers to transfer saved passwords to applications requiring credentials, the clipboard isn’t really a secure place as it is a shared resource that any application can monitor: [WayBack] Is a password in the clipboard vulnerable to attacks? – Information Security Stack Exchange.
It’s just that often the clipboard is about the only way to communicate date between two applications.
The real reason to get rid of the clipboard history is that in many Delphi versions it causes trouble with RichEdit controls: [Archive.is] Castalia’s Clipboard history + TRichEdit = IDE deadlock | Andy’s Blog and Tools after Eugene Kotlyarov posted a [WayBack] bug issue on G+.
I’m still not sure why Castalia and Delphi include a Clipboard History and even show it by default as:
- that makes unwanted data like passwords a lot easier to watch over your shoulder
- there are plenty of existing Clipboard History tools with more elaborate functionality, often for free: [WayBack] 6 Free Clipboard History Managers to Track What You Copy & Paste or
If you would want to build such a tool (that can hide itself when not needed), then use the free repository at chrisrolliston/CCR.Clipboard: Extended TClipboard implementation for Delphi (FMX and VCL) [Archive.is] Ditto download | SourceForge.net
At G+, Attila Kovacs published a non-intended version of the below version: [WayBack]
–jeroen
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. |
Leave a comment