Custom AppWizard to Create MFC Based Windows NT Services

First of all, let me explain that this article is not intended to give you information about writing a Windows NT Service.

Normally a Windows NT Service is supposed to be a console win32 application. But this is not a restriction. In other words, you can write a Windows NT Service that uses Microsoft Foundation Classes. One way of writing such an application is that you start from a standard MFC based SDI, MDI or Dialog based application. But soon you will realize that there is a lot of code that is just useless or is extraneous to the project. You can obviously just ignore this code, but why have code in your application that you know is never going to be used? One alternative is to allow AppWizard to generate this extra code and then go in and manually remove the unnecessary code from your project. However, what if you want to write another such application? Well you could become expert in this 'Code Removing' process but it certainly wouldn't be a very effecient use of your time.

A better way would be to have a Custom AppWizard that does this automatically for you. I felt the need for such an AppWizard when I was writing my second Windows NT Service that needed to use MFC quite extensively. I created an MFC dialog-based application and then removed the extra code. Then, I added a new file to the project in which I added all the code that was necessary to make an application a Windows NT Service. I built the project and confirmed that it was working fine. After this I created a new project of type "Custom AppWizard". This project was based on my previously built project. I chose the "An existing project" option in the 'Step 1 of 2' and in 'Step 2 of 2' of the Wizard. I also specified the path of my previous project. After a few minor changes to the template files of the project I succeeded in creating a Custom AppWizard that could generate a project for a Windows NT Service and that would save me the time of manually removing unnecessary code every time I wanted to write a service.

The Projects generated by this AppWizard are defined as 'Minimal Windows NT Services'. If you create a project from this Custom AppWizard and build it, your application will fulfill all the requirements of a Windows NT Service, although it will not be doing any thing. In other words, like any other AppWizard, my template files are used to create the framework for your code so that you only have to be concerned with code that is specific to your application's needs.

Installation: Simply copy the NTService.awx file to the "...\DevStudio\SharedIDE\Template" folder.

Note: If you need help writing and understanding Windows NT Services, please feel free to email me.:o)

Download source - 42 KB

Date Last Updated: February 14, 1999



Comments

  • failed to load custom AppWizard

    Posted by Legacy on 05/18/2003 12:00am

    Originally posted by: hello peeps !

    have no idea but i keep getting this message ,,, failed to load custom AppWizard.....any ideas ....
    Thanx

    • Re: failed to load custom AppWizard

      Posted by rockone on 12/29/2004 10:28pm

      rebuild the project by your VC compiler, and it will copy the .awx to the right place.

      Reply
    Reply
  • Lack is better than worse version

    Posted by Legacy on 11/11/2002 12:00am

    Originally posted by: stan

    as title.

    Reply
  • win32 console app integrated into Window Service or ATL Service

    Posted by Legacy on 10/24/2002 12:00am

    Originally posted by: ruilin yang

    Guru's,

    Please help me. I am a relatively new c++/MFC programers. I created an ATL service module and compiled successfully. I also write a seperate win32 console program using ADO to do database manapulations, which works fine. I want to implement this win console program as window service (ATL Service) or integrate it to my ATL Service program.

    I like a Service program to call (or integrate) my Win32 console program. When I add my win32 console .cpp files to my ATL project I can not get compiled. There are certainly a lots conflicts. I do not need any displaying windows.

    Please give me some advance for the integration.

    thanks in advance.

    Ruilin

    Reply
  • Thank You

    Posted by Legacy on 07/29/2002 12:00am

    Originally posted by: Vicki Dillon

    Thank you so much!
    I had been pulling my hair out trying to figure out how to get MFC into an ATL Service project. Your article provided the information that was the key to my enlightenment.
    Again thanks very much!

    Reply
  • sdk using Animation

    Posted by Legacy on 07/21/2002 12:00am

    Originally posted by: S.Rajkumar

    hi,
    i am M.C.A student, i am undergoing 5th semester
    now, i am very much interseted to do my mini projects
    in vc++, using sdk.
    If u have any idea about animation, using
    sdk, plz give me a idea, it is very much useful to me.
    i am awaiting for ur ideas.
    by!by!
    yours lovingly,
    raj.

    Reply
  • MFC NT SERVICE

    Posted by Legacy on 03/14/2002 12:00am

    Originally posted by: RAMESH

    I HAVE DEVOLPED AN MFC DIALOG BASED APPLICATION.HOW CAN I PUT INTO THE CONTROL APNEL SERVICES.

    PLS AMIL ME
    URGENT
    THANK U
    BYE
    EGATE114

    Reply
  • #if or #ifdef blocks nested too deeply

    Posted by Legacy on 01/14/2002 12:00am

    Originally posted by: zhangsuocheng

       When I compile my project,please reply me,I am worried.
    

    Reply
  • Does not work in VC 6 !!

    Posted by Legacy on 11/10/2001 12:00am

    Originally posted by: prem

    Platform: VC 6.0, NT server.

    I am getting 'AppWizard Failed to load custom AppWizard...' after using the NTService.awx file. Can you send me a new one for VC 6 to premkumarjayaram@hotmail.com.

    Thanks.
    Prem

    Reply
  • Can't compile - missing files

    Posted by Legacy on 08/30/2001 12:00am

    Originally posted by: Sonin Nickolay

    I cant compile this project at all - VC++ 6 tells "file not found" on some position in it.
    Could you please send me a full set of this project files?

    Reply
  • VC6 'AppWizard Failed to load custom AppWizard' error.

    Posted by Legacy on 08/17/2001 12:00am

    Originally posted by: Nick

    (Using VC6)

    I’ve copied the NTService.awx to my msdev98\bin\ide folder but when I try to select the NTService.awx item from the new->projects dialog I get an 'AppWizard Failed to load custom AppWizard...' error (the same as submitted by Allen on 1999/09/22).

    Is there a fix for this yet?

    Thanks for your help,

    Nick.

    Reply
  • Loading, Please Wait ...

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • This ESG study by Mark Peters evaluated a common industry-standard disk VTl deduplication system (with 15:1 reduction ratio) versus a tape library with LTO-5, drives with full nightly backups, over a five-year period.  The scenarios included replicated systems and offsite tape vaults.  In all circumstances, the TCO for VTL with deduplication ranged from about 2 to 4 times more expensive than the LTO-5 tape library TCO. The paper shares recent ESG research and lots more. 

  • Java developers know that testing code changes can be a huge pain, and waiting for an application to redeploy after a code fix can take an eternity. Wouldn't it be great if you could see your code changes immediately, fine-tune, debug, explore and deploy code without waiting for ages? In this white paper, find out how that's possible with a Java plugin that drastically changes the way you develop, test and run Java applications. Discover the advantages of this plugin, and the changes you can expect to see …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds