Setting Up Your Environment

There are five steps to set up your environment:

  1. Creating a New MFC Project
  2. Running the AppWizard
  3. Adding File Locations
  4. Configuring the Build
  5. Adding Project Files


Creating a New MFC Project

  1. Select the File > New > Project tab.

  2. Select MFC APPWizard (dll) from the project list.

  3. Type the name of the project (MySnapIn) in the Project Name field.

    Your project name is then appended to the Location field.

  4. Click OK to begin the Visual C++ AppWizard, as shown in the following screen shot.


    AppWizard screen shot


Running the AppWizard

  1. Select the type of DLL you would like to create.

    We recommend the first option, Regular DLL with MFC statically linked, because it links the MFC DLL at build time and does not require the MFC DLLs to be redistributed.

    The second option, Regular DLL using shared MFC DLL, decreases the overall file size of the DLL but requires the MFC DLLs to be redistributed.

    The third option, MFC Extension DLL (using shared MFC DLL), is not supported because it allows only MFC-based applications to call its functions directly.

  2. Select any DLL features.

    We recommend that you do not select any DLL features. OLE Automation and Windows Socket support are not included in this tutorial and should remain unchecked.

  3. Select whether AppWizard should generate source file comments.

    If you are new to Visual C++ and MFC programming, we recommend you select Yes for this option.

  4. Click Finish to complete the AppWizard.

  5. If everything in the resulting dialog box is acceptable, click OK to continue. Otherwise, click Cancel to return to the AppWizard.


Adding File Locations

  1. Select the Tools > Options > Directories tab.

  2. From the Show Directories For box, select Include Files.

  3. Add Novell's NDK include directory to the list of available directories.

    By default, the include directory is c:\Novell\NDK\include.

  4. From the Show Directories For box, select Library Files.

  5. Add Novell's NDK library directory for Visual C++ to the list of available directories.

    By default, the library directory is c:\Novell\NDK\nwsdk\lib\win32\mscvc.

    This step will be eliminated from future snap-in modules as this directory becomes part of the default settings in Visual C++.

  6. Click OK.


Configuring the Build

  1. To build a release DLL version, select Build > Set Active Configuration > Win32 Release > OK.

  2. To configure the project not to use precompiled headers, select the Project > Settings > C/C++ tab.

  3. Change the Category to Precompiled Headers and select Not Using Precompiled Headers.

  4. Click the Link tab and change the file extension from .dll to .pc2 in the Output File Name field so that NetWare Administrator will recognize the file.

    AppWizard will now build a copy of the snap-in control in a release subdirectory located off the source project directory.

    NOTE:  If you were building a Windows 3.1 snap-in, you would have to change the file extension from .dll to .pc1 so that NetWare Administrator would recognize the file.

  5. Link the NDPS library files to the project by typing the library file names in the Object/library Modules field as follows:

    dppwin32.lib dpawin32.lib dplwin32.lib

    If multiple libraries are required, separate each filename with a space.

  6. Click OK.

  7. Select Win32 Debug from Settings For and repeat Steps 3 through 6 to apply these same settings to the debug snap-in version.


Adding Project Files

  1. Copy snapin.cpp and npc.h to the source project directory.

    By default, these files are located in c:\Novell\NDK\samples\ndps\printer_ctrl_snapin.

  2. Include these two files in the project by selecting Project > Add To Project > Files from the main menu.

  3. Control-click the snapin.cpp and npc.h files.

  4. Click OK.