Custom AppWizard to Create MFC Based Windows NT Services


Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame

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


  • failed to load custom AppWizard

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

    Originally posted by: hello peeps !

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

    • Re: failed to load custom AppWizard

      Posted by rockone on 12/30/2004 06:28am

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

  • Lack is better than worse version

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

    Originally posted by: stan

    as title.

  • win32 console app integrated into Window Service or ATL Service

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

    Originally posted by: ruilin yang


    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.


  • Thank You

    Posted by Legacy on 07/29/2002 07: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!

  • sdk using Animation

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

    Originally posted by: S.Rajkumar

    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.
    yours lovingly,


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

    Originally posted by: RAMESH



  • #if or #ifdef blocks nested too deeply

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

    Originally posted by: zhangsuocheng

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

  • Does not work in VC 6 !!

    Posted by Legacy on 11/10/2001 08: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.


  • Can't compile - missing files

    Posted by Legacy on 08/30/2001 07: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?

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

    Posted by Legacy on 08/17/2001 07: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,


  • Loading, Please Wait ...

  • You must have javascript enabled in order to post comments.

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

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date