tag:blogger.com,1999:blog-29331675.post115321885382259882..comments2024-03-05T17:37:00.995+01:00Comments on The Delphi Geek: Trouble with servicesgabr42http://www.blogger.com/profile/06903558857617342477noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-29331675.post-80995731584178116012019-05-14T13:21:59.843+02:002019-05-14T13:21:59.843+02:00This comment has been removed by a blog administrator.Larry A.https://www.blogger.com/profile/06291795412967440865noreply@blogger.comtag:blogger.com,1999:blog-29331675.post-1155733863336135452006-08-16T15:11:00.000+02:002006-08-16T15:11:00.000+02:00That certainly sounds like a good advice - somethi...That certainly sounds like a good advice - something that I may adopt in the future.gabr42https://www.blogger.com/profile/06903558857617342477noreply@blogger.comtag:blogger.com,1999:blog-29331675.post-1155733249670090872006-08-16T15:00:00.000+02:002006-08-16T15:00:00.000+02:00Alternate solution:Make your service module ULTRA ...Alternate solution:<BR/><BR/>Make your service module ULTRA lightweight. Put all your actual code into a datamodule. Datamodule gets created and destroyed in the OnExecute.<BR/><BR/>Do real work in the data module, and voila, problem solved, except for knowing when you have have extra threading issues brought by third party libraries like the BDE.<BR/><BR/>Of course, for a long time I just used Peter Sawatzki which does let you use VCL code - it all runs in the primary thread and you just put a lightweight loop in the service thread itself. Sadly, he hasn't maintained it and as delphi and windows evolved, it has started to develop "issues".Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-29331675.post-1153498731549088222006-07-21T18:18:00.000+02:002006-07-21T18:18:00.000+02:00It's true, SvCom is great. I'm using it everytime ...It's true, SvCom is great. I'm using it everytime I have to write a service.<BR/><BR/>But it exhibits the same "problem" (we've seen that it is really a design decision, not a problem per se) - OnCreate is called from one thread and OnStart from others.gabr42https://www.blogger.com/profile/06903558857617342477noreply@blogger.comtag:blogger.com,1999:blog-29331675.post-1153475683278861012006-07-21T11:54:00.000+02:002006-07-21T11:54:00.000+02:00HiServices made easy = SVCOMSVCOM has its own time...Hi<BR/><BR/>Services made easy = SVCOM<BR/>SVCOM has its own timer etc<BR/>Agreed:Using datamodules that gets created in onstart is the best way.<BR/><BR/>In onstart I use:<BR/>CoInitialize(nil);<BR/>CreateForms;<BR/><BR/>and in OnStop:<BR/>FreeForms;<BR/>CoUninitialize;<BR/><BR/>Using CreateForms to create all DMs<BR/>and FreeForms to free themAnonymousnoreply@blogger.com