Page 1 of 1

Plugin OnShowRegistrationDialog

Posted: Wed Dec 04, 2013 6:23 pm
by Kymoto
Hi,

I am trying to show my own custom form using the OnShowRegistrationDialog plugin function however when the function is called I am getting the following error message:

---------------------------
The Enigma Protector
---------------------------
Internal Protection Error, please contact to author!
---------------------------
OK
---------------------------

I have created a new blank form (TForm1 which is listed in the uses section as Unit1) and I'm using the following to create and display it:

Code: Select all

function Enigma_Plugin_OnShowRegistrationDialog : boolean;
var
  Dialog: TForm1;
begin
  Dialog := TForm1.Create(nil);
  try
    Dialog.ShowModal;
  finally
    Dialog.Free;
  end;
  Result := True;
end;
However if I don't use the visual form (TForm1) and just call the TForm.Create(nil) directly, the form is displayed fine.

Any help with this would be great

Thanks,
Tim

Re: Plugin OnShowRegistrationDialog

Posted: Thu Dec 05, 2013 9:42 am
by Enigma
Unfortunately, the way you are trying won't work with Enigma Protector. The problem happens due to specific of the Delphi, and how it shows forms.

As far as I remember, this problem can be solved if you call this method of the form create:

Code: Select all

Dialog := TForm1.CreateNew();
With CreateNew it should work. But for such form you will have to create all form element/control yourselves, DFM form won't work.

Also, light weight implementation would be by using Windows API function only, like CreateWindow etc, it will also work.

Re: Plugin OnShowRegistrationDialog

Posted: Thu Dec 05, 2013 6:07 pm
by Kymoto
Using the CreateNew function has allowed me to create the new form which in turn has I can do what I wanted to do with the form (override the Creation, CreateParams & CreateWnd).

With the original dialog I was creating the controls from code anyway, so it just required a quick copy & paste

Thanks for the pointers.

Tim

Re: Plugin OnShowRegistrationDialog

Posted: Fri Dec 06, 2013 11:14 am
by Enigma
OK, you are welcome.