MessageDlg at start of file

I am working on an encryption program in Delphi 2.0. The program is able to encrypt the selected file(s) but, for instance, if the file is a .txt, once you open the encrypted version it shows you the encrypted text. But I would rather have it that the encypting program could write a small piece of code at the start of every encrypted file with say a MessageDlg saying - 'This file has been encrypted. Do you wish to decrypt now?' with mbyes, mbno and if mryes then a shell execute to the encryption program.

Any help appreciated.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

That's possible, but the encrypted files will grow by about 20 KB. If that is no problem you can simply do something like this:

project EncryptedFileHeader;

uses Windows;

  if MessageBox(0, 'This file is encrypted. Do you wish to decrypt it now?', 'Encrypted file...',MB_YESNO) = IDYES then
    ShellExecute(0, nil, pchar('c:\yourPath\yourDecrypt.exe "' + ParamStr(0) + '"'), nil, nil, SW_SHORNORMAL);

Now if the user starts this encrypted file and chooses "yes", then yourDecrypt.exe is started with the encrypted file as the first parameter.

Now how can you create such an encrypted file? Simple: You have to create a new exe file and save first the EncryptedFileHeader.exe in the new file and then behind it the encrypted data. Of course the extensions of the encrypted file *must* be "exe".

YourDecrypt.exe then has to accept such a file and extract the data from the combined exe+data file.

Regards, Madshi.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.