Author | Topic: waa and own threads | |
---|---|---|
Jeremy Suiter | waa and own threads on Fri, 24 Jun 2005 15:37:19 +0100 Is there a way to start your own seperate thread when WAA loads that can perform tasks at given times? In my case it's just to send an email out every 1/2 hour. TIA Jeremy | |
Sander Elias | Re: waa and own threads on Fri, 24 Jun 2005 16:43:37 +0200 Hi Jeremy, >Is there a way to start your own seperate thread when WAA loads that can >perform tasks at given times? It is just an DLL that gets loaded, so you could de several things. use an init procedure/function, or adapt the _register function. so you might put this in: init proc initemailsend() thread():new():start(||emailsend}) return function emailsen() do while .t. //do my thing sleep(30*60*100) 30Mins 60 secs .001 second enddo in stead of the init proc you cane put the thread start line in your _register function. Hope this helps Regards Sander | |
Jeremy Suiter | Re: waa and own threads on Fri, 24 Jun 2005 15:58:55 +0100 I thought about that, but the inbuilt sendmail function needs oContext which doesn't seem to be available when the _register function is called. Jeremy "Sander Elias" <Sander@eso.nl> wrote in message news:mn6ob1delfsg04to8t6fqfp12qor1k1dem@4ax.com... > Hi Jeremy, >>Is there a way to start your own seperate thread when WAA loads that can >>perform tasks at given times? > It is just an DLL that gets loaded, so you could de several things. > use an init procedure/function, or adapt the _register function. > > so you might put this in: > > init proc initemailsend() > thread():new():start(||emailsend}) > return > > function emailsen() > do while .t. > //do my thing > sleep(30*60*100) 30Mins 60 secs .001 second > enddo > > in stead of the init proc you cane put the thread start line in your > _register function. > > Hope this helps > Regards > Sander | |
Sander Elias | Re: waa and own threads on Fri, 24 Jun 2005 17:34:33 +0200 Jeremy, >I thought about that, but the inbuilt sendmail function needs oContext which >doesn't seem to be available when the _register function is called. ok 2 solutions, 1. do a runshell to start the IE, to fetch a page that starts your routine. something like runshell("http://localhost/startmymailthingie") 2. Use a different e-mail sending solution. there are a few options. the sendmail option is depended on the web server being configured all right, and that the server is allowed to send mail. use asinet or see4xb to send your mail. this will work independent from you web server. regards Sander | |
Phil Ide | Re: waa and own threads on Fri, 24 Jun 2005 17:57:32 +0100 Sander, >>I thought about that, but the inbuilt sendmail function needs oContext which >>doesn't seem to be available when the _register function is called. Firstly, ASINET is part of WAA, so if you have the professinal subscription (for the asinet1c.lib) then you can use this. Alternatively, it is possible to create a context object like this: a := &("Context()") a := a:new() However, you cannot send a mail like this because oContext requires a socket connection to waa1gate.exe. In this case, you'll have to use ASINET classes or Xb2.NET or another library capable of sending emails. Regards, Phil Ide *************************************** * Xbase++ FAQ, Libraries and Sources: * * goto: http://www.idep.org.uk/xbase * *************************************** Life sucks and then you marry one who won't. |