As I mentioned in Chapter 10, the Microsoft Foundation Classes (MFC) have good support for ISAPI. Better yet, the ISAPI extension or filter can use only the ISAPI support within MFC, making for a leaner ISAPI application than might otherwise be possible.
The first step in creating an ISAPI filter is to select New from the File menu in Visual C++. The screen shown in Figure 11-4 will appear. Select ISAPI Extension Wizard and enter the name of the project.
Figure 11-4 Visual C++ New dialog.
Figure 11-5 shows screen 1 of 2 of the ISAPI Extension Wizard. I have changed the default settings so that Generate A Filter Object is checked and Generate A Server Extension Object is unchecked. If you check both settings, a single DLL can contain both an extension and a filter. Unless a great deal of functionality is shared between an extension and a filter and it is not necessary to expose that functionality in a DLL that can be shared, I recommend that you always create the objects in separate DLLs.
Figure 11-5 Step 1 of 2 in the Visual C++ ISAPI Extension Wizard.
Figure 11-6 shows the final step of the ISAPI Extension Wizard. The same notifications used by the basic C++ ISAPI filter in Listing 11-3 are selected in this example. We can add a required notification after the fact. However, it is not as simple as adding a value to a bit flag in GetFilterVersion or a case statement in HttpFilterProc . As with much of MFC, mapping macros are used to route notifications to the correct mEember function. Unlike other areas of MFC, there is no wizard support for modifying existing ISAPI filters.
Figure 11-6 Step 2 of 2 in the Visual C++ ISAPI Extension Wizard.