Article ID: 199360 - Last Review: August 9, 2004 - Revision: 4.3 SAMPLE: CmdLanch.exe Launches EXE from Custom Outlook Menu ItemThis article was previously published under Q199360 On This PageSUMMARY
CmdLanch.exe is a self-extracting executable file that contains a custom extension sample written with Microsoft Visual C++ 5.0 for use with Microsoft Outlook 98. The code sample demonstrates how to implement custom command extensions for the Microsoft Outlook Client. CmdLanch creates three menu items and corresponding toolbar buttons then adds them to the Outlook client's menu bar and standard toolbar. The commands currently launch Notepad, Wordpad and Paint respectively. This extension can be easily modified to launch the executable of your choice or to perform other activities from custom Outlook commands. If you want to create custom extensions for use with Outlook 98, then this sample will help you get started. It also gives you a working example of using the Exchange extension interfaces from Visual C++. MORE INFORMATIONThe following file is available for download from the Microsoft Download Center: CmdLanch.EXE
(http://download.microsoft.com/download/outlook98/sample/2/WIN98/EN-US/CmdLanch.EXE
)
Release Date: March 11, 1999For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base: 119591
(http://support.microsoft.com/kb/119591/EN-US/
)
How to Obtain Microsoft Support Files from Online Services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.
Sample File InformationThe CmdLanch.exe file will self extract to produce the following files:File Name Size Description --------------------------------------------------------- CmdLanch.dll 40KB Exchange extension DLL CmdLaunchExe.reg 1KB Extension registration file cmdExt.cpp 28KB Main extension source file cmdExt.h 6KB main extension header file CmdLaunchExe.dsp 4KB Microsoft Visual C++ 5.0 project file CmdLaunchExe.dsw 1KB Microsoft Visual C++ 5.0 workspace file resource.h 1KB Extension resource header file script1.rc 3KB Extension resource template bitmap2.bmp 1KB Toolbar button bitmap resource bitmap3.bmp 1KB Toolbar button bitmap resource bitmap4.bmp 1KB Toolbar button bitmap resource Installing and Configuring the Sample
Instructions for Customizing CmdLaunchExe.dllThe source for this sample was created using VC++ 5.0 Service Pack 3. You can modify the source for this extension to reflect your own menu item and toolbar button bitmaps. (See the MyExchExtCommands::InstallCommands method for more information.)The .exe that launches can be changed by editing the MyExchExtCommands::DoCommand method. Alternatively, you could request the .exe location from the user using the CommonDialog control. You will also want to edit the following methods to reflect your own text requirements:
MyExchExtCommands::Help MyExchExtCommands::QueryHelpText MyExchExtCommands::QueryButtonInfo More Exchange Extension InformationThis sample requires Microsoft Windows NT 3.51 or Windows 95, the MAPI 1.0 PDK, Microsoft Visual C++ version 2.0 (or later), and the Win32 Platform SDK.Exchange client extensions are designed using OLE's Component Object Model. The Client calls methods, which are provided in the extension. In some calls to the extension interface, a pointer to a callback interface is used (IExchExtCallback) for the extension to call back into the Exchange client. For more information regarding this interface, please see "Extending the Microsoft Exchange Client" in the MAPI PDK documentation. This sample implements three interface objects: IExchExt, IExchExtCommands, and IExchExtUserEvents. To extend the command set of Exchange, it is necessary to provide implementations for IExchExt and IExchExtCommands. It is optional to provide implementation for IExchExtUserEvents. This sample implements IExchExtUserEvents to enable or disable the custom command, depending on what object the user is selecting in the Exchange main viewer. The menu item is always enabled in the Search Folder dialog box. The custom command is available in both the Main viewer and the Search Folder dialog box. The IExchExtCommands provides an interface for the client to display context help on the custom menu item and to display tooltip text and status window text. Select the custom menu item and press F1 to open an About dialog box. This extension works in two different contexts, main viewer and search dialog. For each context an extension supports, a complete set of interface objects is created. In this sample, the MyExchExt, MyExchExtCommands and MyExchExtUserEvents objects are created once for the main viewer context and once for the search dialog. However, because there is only one implementation for all contexts, there is a context flag data member which indicates from which context Exchange is calling. A context in many cases corresponds to a user interface. For example, the search viewer is one context and the main viewer is another. QueryInterface is called for each interface identifier (IID) for each context. In this example, QueryInterface is called each time for all IIDs in the main viewer context when Exchange first starts. QueryInterface is called again each time for all IIDs in the search viewer context. For each of the contexts, a unique pointer to the MyExchExtCommands and MyExchExtUserEvents objects is returned to Exchange in the QueryInterface call. Then when Exchange is calling DoCommands from the search viewer, it is calling the one using the interface pointer returned to it through QueryInterface in the search viewer context. When Exchange is calling DoCommands from the main viewer, it is calling the one using the interface pointer returned to it through QueryInterface in the main viewer context.
| Article Translations
|
Back to the top
