MFC application as a service
Ram Kishore -- Ram_Kishore.IDEA@idea.com Monday, November 18, 1996 Environment: VC++ 4.2b, NT 4.0 Hi all, How can you make an MFC based application a service ? Can somebody point me somewhere ? Thanks in Advance Ram rkishore@idea.com
Samuel R. Blackburn -- sblackbu@csc.com Wednesday, November 20, 1996 [Mini-digest: 8 responses] Take a look at the CService and CServiceControlManager classes in the freeware Win32 Foundation Classes (WFC) class library. There are also several sample services included in the package. http://ourworld.compuserve.com/homepages/sam_blackburn/wfc.htm ---------- > From: Ram Kishore> To: mfc-l > Subject: MFC application as a service > Date: Monday, November 18, 1996 12:12 PM >=20 > Environment: VC++ 4.2b, NT 4.0 >=20 > Hi all, > How can you make an MFC based application a service ? > Can somebody point me somewhere ?=20 >=20 > Thanks in Advance > Ram=20 > rkishore@idea.com >=20 -----From: wayne.dengel@octel.com I've already done this. =20 I've got a App_Wizard if it will help. =20 1: Your app needs to have a sperate thread, that will run as the=20 SERVICE. This thread needs to be able to post to your main app, whe= n=20 the service is shut down. 2: Your app shoudl not have a user interface. My MFC based service= s=20 have seperate applets that act as interfaces to the service. 3: On the DevNet CD there is a service example. It will show who t= o=20 get set the service up. You will need to move this code into a=20 seperate thread, mentioned above.=20 =20 Hope this help. A bit vague, but anyway good luck. =20 wAyNe =20 -----From: Ian Pepper Check out the Windows Foundation Classes (WFC). This set of classes extends MFC and includes a class to encapsulate the service API. Try e-mailing Sammy Blackburn at sammy@sed.csc.com (the author) for details. Ian ian@flexicom.ie -----From: "Bernard D'Have" Look at MSDB lib with CService class Bernard D'Hav=E9 Tedisys sa -----From: Luke Stephens Just so you know, it is possible because I have done this. It's not much different that creating a regular console based service. =20 You need to call StartServiceCtrlDispatcher(....) in your InitInstance() = of the app or you could create a thread and call it from there. =20 When your service control handler receives shutdown or stop requests, you= need send a WM_CLOSE message to the main window of your app. If you have any specific questions, let me know. Luke Stephens luker@tfs.net -----From: Shane Griggs There comes with the resource kit for NT3.51 an app called srvany.exe. Ha= ve successfully run standard winmain apps running under it on NT4.0 with statically linked mfc classes. --------------------------------------------------- Shane Griggs Mission Software Ltd Software Development, Internet, Intranet and Web Consulting=20 =20 SnailMail: P.O Box 7425 Christchurch New Zealand Email: shane@mission.co.nz Phone: +64 3 358 7425 Fax: +64 3 358 7426 -----From: mario@edc.sorostm.ro (Mercea Mario) you can look here: http://ourworld.compuserve.com/homepages/Sam_Blackburn= /wfc.htm there are some cool free classes, and there you can find anything which i= s not included in MFC, the source code is included and anything is free!!! I had seen there CService, which I think will do what you want! -- |\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| | Mercea Mario | |----------------------------------------| | BBS/FAX: +40-(0)56-133423 | | E-Mail: mario@edc.sorostm.ro | |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\| -----From: "Frank McGeough" If you are writing a service MFC is not appropriate. Since a=20 service has no UI an MFC application would be gutted to=20 turn it into a service. I would start from what you want the service to provide and work towards getting a set of classes that provide those services. Your app may have already seperated most of the classes that you need in your service. I would extract those and put a service wrapper around them. Check out CNTService - Writing a Simple Service in the MSDN. Good luck.
| Вернуться в корень Архива |