Protecting Application's Title

Post here any topics that related to Enigma Protector, its functionality, your misunderstanding, offers to improvements etc etc etc
Post Reply
Majid
Posts: 138
Joined: Mon Nov 29, 2010 2:54 pm
Location: Iran
Contact:

Protecting Application's Title

Post by Majid » Wed Jul 27, 2011 2:13 pm

Hi Enigma

First Read This Please:

Think I have a small media player. It supports drag'n'drop. The window title is the name of mp3 file. Think I have played Enigma.mp3 with it, then the title will be "Enigma", If play majid.exe ,the title will be "majid". I want to lock the title, For example if the title is something expect Enigma, the player close.

I mean this: The player is playing Enigma.mp3 and the title is "Enigma", If I drag'n'drop Majid.mp3, the tile will become "Majid", I want the app become close after changing the title, Possible?
Brothers To The End...

Enigma
Site Admin
Posts: 2516
Joined: Wed Aug 20, 2008 2:24 pm

Re: Protecting Application's Title

Post by Enigma » Thu Jul 28, 2011 7:52 am

Hi Majid, everything is possible through plugins :)

Through plugin you can create a Thread or Timer object that will use function like FindWindow and search the window inside current process with the necessary title. If windows is not found - just close application!

Majid
Posts: 138
Joined: Mon Nov 29, 2010 2:54 pm
Location: Iran
Contact:

Re: Protecting Application's Title

Post by Majid » Thu Jul 28, 2011 8:14 am

But How? Can you guide me step by step please?
Brothers To The End...

Enigma
Site Admin
Posts: 2516
Joined: Wed Aug 20, 2008 2:24 pm

Re: Protecting Application's Title

Post by Enigma » Thu Jul 28, 2011 9:51 am

This could be done very simple.

There is undocumented function in Enigma SDK - EP_CheckupFindProcess, it has following definition:

Code: Select all

function EP_CheckupFindProcess(FileName, WindowText, WindowClass : PAnsiChar) : boolean; external enigma_api_dll_name name 'EP_CheckupFindProcess';
function EP_CheckupFindProcessA(FileName, WindowText, WindowClass : PAnsiChar) : boolean; external enigma_api_dll_name name 'EP_CheckupFindProcessA';
function EP_CheckupFindProcessW(FileName, WindowText, WindowClass : PWideChar) : boolean; external enigma_api_dll_name name 'EP_CheckupFindProcessW';
So, in the plugin, you create a thread or timer, that will periodically (maybe 1 time per 2-5 seconds) check if the necessary window is opened. You will call EP_CheckupFindProcess with the following parameters:
FileName - file name of your protected application
WindowText - *enigma* (so the text of the window should contain word Enigma)
WindowClass - you may keep it empty, or, for better detection, you may open in Enigma Protector the panel Checkup - Executed Process, then click Add Processes button, then find your window in the list and get it Class name. And you may use this class name when you call EP_CheckupFindProcess.

If this function will return false, then such window is not found, and you may terminate your application.

Do you forget to make a delay from the application start before checking of the window, because there is needed some time from calling of plugin till showing of the window.

Post Reply