Community Discussions and Support
Being able to turn a Daemon on and off from the menu

The idea is that you provide an exported function that sets a variable in the dll that controls if the main daemon function will be active or not. There are severals ways to do it, a dialog window with a checkbox for instance. Below is Pascal code for a simple configuration function (this one only shows a message box).

/Rolf

 

function configure (var m:TMInterface; name, parameter: pChar):shortint;export;cdecl;
begin
  messagebox(MainW, pChar('Parameter is '+parameter), name, MB_OK);
  Result:=1;
end;
<p>The idea is that you provide an exported function that sets a variable in the dll that controls if the main daemon function will be active or not. There are severals ways to do it, a dialog window with a checkbox for instance. Below is Pascal code for a simple configuration function (this one only shows a message box). </p><p>/Rolf</p><p> </p><blockquote>function configure (var m:TMInterface; name, parameter: pChar):shortint;export;cdecl; begin   messagebox(MainW, pChar('Parameter is '+parameter), name, MB_OK);   Result:=1; end;</blockquote>

Hi,

 I have written a working Daemon to forward messages to a mobile device via a text message.

 However... I would like to be able to turn the Daemon on and off from within the menu. (A bit like you can choose if the built in Mercury modules run or not.) I think the answer to this problem may be to add to the .ini file I have written for my Daemon?? At present my .ini file contains:

[global daemons]
SMSForwarding=c:\MERCURY\mercury_daemon.dll
[Daemon_Config]
SMSForwarding=c:\MERCURY\mercury_daemon.dll

The term 'SMSForwarding' is appering in my Mercury menu under Configuration. Ideally I'd like some kind of 'on/off' toggle alongside it to turn it on or off.

 Many thanks,

Alastair

<P>Hi,</P> <P> I have written a working Daemon to forward messages to a mobile device via a text message.</P> <P> However... I would like to be able to turn the Daemon on and off from within the menu. (A bit like you can choose if the built in Mercury modules run or not.) I think the answer to this problem may be to add to the .ini file I have written for my Daemon?? At present my .ini file contains:</P> <P>[global daemons] SMSForwarding=c:\MERCURY\mercury_daemon.dll [Daemon_Config] SMSForwarding=c:\MERCURY\mercury_daemon.dll</P> <P>The term 'SMSForwarding' is appering in my Mercury menu under Configuration. Ideally I'd like some kind of 'on/off' toggle alongside it to turn it on or off.</P> <P> Many thanks,</P> <P>Alastair</P>

You need to provide a function for the configuration in the dll:
   short _export configure (M_INTERFACE *mi, char *name, char *param);

Use this to open a dialog to change settings for your daemon (for instance switch it on or off).

Please see the instructions in daemon.txt, section 4.4

/Rolf 

<p>You need to provide a function for the configuration in the dll:    short _export configure (M_INTERFACE *mi, char *name, char *param);</p><p>Use this to open a dialog to change settings for your daemon (for instance switch it on or off). </p><p>Please see the instructions in daemon.txt, section 4.4</p><p>/Rolf </p>

Hi Rolf thanks for your post.

 I've read through the relevant section of the documentation but am still a little confused.

I added the relevant line to my .dll but don't understand how this would result in a dialogue box being dispayed in Mercury.

 Do you have an exmple of where this is done from which I can work?

 Many thanks,

Alastair

<P>Hi Rolf thanks for your post.</P> <P> I've read through the relevant section of the documentation but am still a little confused.</P> <P>I added the relevant line to my .dll but don't understand how this would result in a dialogue box being dispayed in Mercury.</P> <P> Do you have an exmple of where this is done from which I can work?</P> <P> Many thanks,</P> <P>Alastair</P>
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft