Clearing Clipboard

x64 version issues
Post Reply
ArniVLK
Posts: 6
Joined: Wed Apr 29, 2020 9:38 pm

Clearing Clipboard

Post by ArniVLK »

Enigma x 64 7.20
Use checkup of executed processes ->Terminate if hidden process found.
Q:
How can I clear the clipboard when closing the program?
(So that the user cannot paste the data copied from the protected program window after closing it into another program.)
Maybe there is a plugin?
Enigma
Site Admin
Posts: 2992
Joined: Wed Aug 20, 2008 2:24 pm

Re: Clearing Clipboard

Post by Enigma »

Yes, this is possible to make through plugin. In plugin you can use Enigma API functions, like EP_CheckupFindProcess, to find the process yourselves. If process found - clear clipboard and close application.

In this case, the option Checkup - Executed Process - Terminate application should be disabled (together with the message).
ArniVLK
Posts: 6
Joined: Wed Apr 29, 2020 9:38 pm

Re: Clearing Clipboard

Post by ArniVLK »

Enigma wrote: Mon Feb 06, 2023 12:56 pm use Enigma API functions, like EP_CheckupFindProcess
I'm an amateur, I'm trying to improve, if possible, see if I'm doing the right thing
(it is possible in the PM or by mail (I am an official user)

Code: Select all

unit test_Clipboard;
uses
  Windows, Clipbrd, enigma_ide;
function Enigma_Plugin_About : PWideChar;
begin
  Enigma_Plugin_About := 'Enigma Clipboard Clear&Terminate Apps if present process notepad';
end;
function Enigma_Plugin_Description : PWideChar;
begin
  Enigma_Plugin_Description := 'Enigma Clipboard Clear&Terminate Apps if present process notepad';
end;
procedure Enigma_Plugin_OnInit;
function EP_CheckupFindProcess : PAnsiChar;
begin
  if EP_CheckupFindProcess (FileName('Notepad.exe'),(WindowText('Notepad'))) then
  begin
    if OpenClipboard(0) then
        try
           EmptyClipboard;
        finally
           CloseClipboard;
  end else
  begin
    TerminateProcess(DWORD(-1), 0)
  end;
end;
exports
  Enigma_Plugin_About,
  Enigma_Plugin_Description,
  Enigma_Plugin_OnInit,
begin
end.
Enigma
Site Admin
Posts: 2992
Joined: Wed Aug 20, 2008 2:24 pm

Re: Clearing Clipboard

Post by Enigma »

This looks ok, if it fits your needs.

If you need more accurate filters for detection, worth to use Enigma API function EP_CheckupFindProcessEx.
ArniVLK
Posts: 6
Joined: Wed Apr 29, 2020 9:38 pm

Re: Clearing Clipboard

Post by ArniVLK »

This looks ok, if it fits your needs.
thanks!
q- "uses enigma_ide"
- no need to specify the path to enigma_ide.pas ?
q2 - " if EP_CheckupFindProcess (FileName('Notepad.exe'),(WindowText('Notepad'))) then"
- how it works - (FileName('Notepad.exe') OR (WindowText('Notepad') /(FileName('Notepad.exe') AND (WindowText('Notepad') ? No need to specify here "IS", "CONTAINS" ?
q3 - how do I specify the frequency of the process detection check? (2s, 5s etc) ?
******
q4 - attach

Sorry for the possibly lamers questions :(
Attachments
option3.jpg
option3.jpg (208.4 KiB) Viewed 45871 times
Enigma
Site Admin
Posts: 2992
Joined: Wed Aug 20, 2008 2:24 pm

Re: Clearing Clipboard

Post by Enigma »

ArniVLK wrote: Tue Feb 07, 2023 5:25 pm q- "uses enigma_ide"
- no need to specify the path to enigma_ide.pas ?
You can just take it from EnigmaSDK folder and add to your Delphi project.
ArniVLK wrote: Tue Feb 07, 2023 5:25 pm q2 - " if EP_CheckupFindProcess (FileName('Notepad.exe'),(WindowText('Notepad'))) then"
- how it works - (FileName('Notepad.exe') OR (WindowText('Notepad') /(FileName('Notepad.exe') AND (WindowText('Notepad') ? No need to specify here "IS", "CONTAINS" ?
If both parameters are specified, it works as AND. If you need to simulate OR, then call EP_CheckupFindProcess two times with either file name, either WindowText.

"IS", "CONTAINS" can be specified in the function EP_CheckupFindProcessEx, I recommend to use it since it is more smart. EP_CheckupFindProcess is kept for compatibility with old versions.
ArniVLK wrote: Tue Feb 07, 2023 5:25 pm q3 - how do I specify the frequency of the process detection check? (2s, 5s etc) ?
Create a thread in plugin and check the thread execution time (or just delay it in 2s, 5s etc). Check sources of other plugins in Enigma, some of them are using thread also.
ArniVLK wrote: Tue Feb 07, 2023 5:25 pmq4 - attach
Unfortunately no, because this option is useful for you only, it will over-complicate interface. Moreover, it can be easy done through plugin.
ArniVLK
Posts: 6
Joined: Wed Apr 29, 2020 9:38 pm

Re: Clearing Clipboard

Post by ArniVLK »

Enigma wrote: Wed Feb 08, 2023 3:32 pm If both parameters are specified, it works as AND. If you need to simulate OR, then call EP_CheckupFindProcess two times with either file name, either WindowText.
Thanks!
it can be easy done through plugin.
:roll:
Of course it's easy for you :)

I tried to compile a test project - an error...
Can you tell me what my mistake is?
Attachments
failed.jpg
failed.jpg (379.78 KiB) Viewed 45840 times
Enigma
Site Admin
Posts: 2992
Joined: Wed Aug 20, 2008 2:24 pm

Re: Clearing Clipboard

Post by Enigma »

ArniVLK wrote: Wed Feb 08, 2023 4:52 pm I tried to compile a test project - an error...
Can you tell me what my mistake is?
Function EP_CheckupFindProcess should receive 3 parameters. When I said that you need to pass just FileName this means that other parameters should be empty, but they have to exists. Like that:
EP_CheckupFindProcess(FileName, nil, nil);
EP_CheckupFindProcess(nil, WindowsText, nil);
EP_CheckupFindProcess(nil, nil, WindowsClass);

But again, better to use EP_CheckupFindProcessEx function.
Post Reply