Page 1 of 1

Plugin OnShowMessage

Posted: Tue Dec 03, 2013 9:40 pm
by Kymoto
Hi,

I am creating a plugin to override the way messages are shown (would like to use the standard Windows message dialog/ Task dialog), but I'm not sure how to get the message text to be shown as the OnShowMessage function is using an integer as the parameter

Code: Select all

function Enigma_Plugin_OnShowMessage(AMessageID : integer) : boolean; stdcall;
How do you go about converting the passed integer to the correct sting?

Thanks
Tim

Re: Plugin OnShowMessage

Posted: Wed Dec 04, 2013 8:54 am
by Enigma
Hi Tim,

That's very simple, you may do that using the following way:

Code: Select all

function Enigma_Plugin_OnShowMessage(AMessageID : integer) : boolean; stdcall;
  begin
  if (AMessageID = MESSAGEID_CHECK_FILENAME) then
  begin
    MessageBox(0, 'Filename is incorrect!', 'Application', MB_ICONERROR);
  end else
  if (AMessageID = MESSAGEID_CHECK_EXECUTEDPROCESSES) then
  begin
    MessageBox(0, 'Bad executed process is found!', 'Application', MB_ICONERROR);
  end;
  Result := 1;
end;

Re: Plugin OnShowMessage

Posted: Wed Dec 04, 2013 6:17 pm
by Kymoto
Thanks, I'm using a case statement as it's a little easier to maintain

Re: Plugin OnShowMessage

Posted: Thu Dec 05, 2013 9:13 am
by Enigma
Kymoto wrote:I'm using a case statement as it's a little easier to maintain
Sure, as you wish.