SAMPLE: Hook.exe MAPI Spooler Hook Provider Sample (C++)

ID: Q224362


The information in this article applies to:


SUMMARY

Hook.exe is a self-extracting file including a sample application that demonstrates the functionality of a MAPI Hook Provider and can also serve as a useful starting point for developers wishing to develop their own hook providers.


MORE INFORMATION

The following file is available for download from the Microsoft Software Library:

Hook.exe
Release Date: Mar-26-1999

For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:
Q119591 How to Obtain Microsoft Support Files from Online Services

Hook.exe 36990
Dsmhook.inf 477
Hook.clw 1230
Hook.cpp 7111
Hook.def 294
Hook.dsp 6408
Hook.dsw 531
Hook.plg 1678
Hook.rc 5949
Hook32.dll 24576
HookClass.cpp 7776
HookClass.h 1790
Readme.txt 3271
Resource.h 765
Stdafx.cpp 206
Stdafx.h 617
Hook.rc2 396

This article contains a summary of what you will find in each of the files that make up Hook DLL, some release notes, and installation instructions.

Files in Hook.exe

Hook.dsp: This file (the project file) contains information at the project level and is used to build a single project or subproject. Other users can share the project (.dsp) file, but they should export the makefiles locally.

Hook.cpp: This is the main DLL source file. It contains the class CHookApp. It contains configuration and initialization routines.

HookClass.h: This file contains the class definition for CHookClass.

HookClass.cpp: This file contains the actual spooler hook functions and support routines contained within CHookClass.

Hook.rc: This is a listing of all of the Microsoft Windows resources that the program uses. It includes the icons, bitmaps, and cursors that are stored in the RES subdirectory. This file can be directly edited in Microsoft Visual C++.

Hook.clw: This file contains information used by ClassWizard to edit existing classes or add new classes. ClassWizard also uses this file to store information needed to create and edit message maps and dialog data maps and to create prototype member functions.

res\Hook.rc2: This file contains resources that are not edited by Microsoft Visual C++. You should place all resources not editable by the resource editor in this file.

Hook.def: This file contains information about the DLL that must be provided to run with Microsoft Windows. It defines parameters such as the name and description of the DLL. It also exports functions from the DLL.

Other Standard Files

StdAfx.h, StdAfx.cpp: These files are used to build a precompiled header (.pch) file named Hook.pch and a precompiled types file named StdAfx.obj.

Resource.h: This is the standard header file that defines new resource IDs. Microsoft Visual C++ reads and updates this file.

Other Notes

Note that Hook Providers, including this one, will not work when using the Microsoft Exchange Transport Provider. This is a result of Exchange's tightly-coupled store and transport (that is, they bypass the MAPI spooler).

If you use Exchange's POP/SMTP/IMAP abilities, the spooler hook will function just fine.

Installation

To install the Sample Hook Provider follow these simple steps:
  1. Extract the source code for the hook provider from the attached file.


  2. Open the attached Microsoft Visual C++ 6.0 workspace, Hook.dsw.


  3. Build the Sample Hook (the output file will be Hook32.dll).


  4. Copy Hook32.dll to your Windows system directory (system32 in Windows NT), for example:
    
    C:\windows\system\"(Windows 9x)
    C:\WinNT\System32\"(Windows NT) 


  5. Merge the contents of DsmHook.inf with your existing MapiSvc.inf file. The MapiSvc.inf file can be found in your Windows system directory.


  6. Create a new profile that uses the hook provider (or add it to an existing profile) via the Control Panel's Mail applet.


Additional query words: MAPISP32 MAPI XMAPI EMAPI HOOK PROVIDER SPOOLER InboundMsgHook OutboundMsgHook HPProviderInit WizardEntry ServiceEntry


Keywords          : kbfile kbsample kbMAPI kbMsg kbVC600 kbMAPI100 kbGrpMsg 
Version           : WINDOWS:1.0
Platform          : WINDOWS 
Issue type        : kbhowto 

Last Reviewed: May 26, 1999