Microsoft KB Archive/152152

= SAMPLE: FRMWRK32.EXE: Updated Generic.xll Template for Excel =

Article ID: 152152

Article Last Modified on 5/23/2005

-

APPLIES TO


 * Microsoft Excel 97 Standard Edition
 * Microsoft Excel 5.0 Standard Edition

-



This article was previously published under Q152152



SUMMARY
The sample code provided contains a template that can used for writing 32-bit Microsoft Excel XLLs for Windows. This code demonstrates many of the features of the Microsoft Excel C API. This sample was updated from the Microsoft Excel Developer's Kit, version 5.

The following file is available for download from the Microsoft Download Center:

Frmwrk32.exe

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 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.



Creating Stand-alone DLLs (XLLs)
Microsoft Excel supports stand-alone DLLs. These are DLLs (or code resources) that the user opens by choosing Open from the File menu and selecting a DLL file or by using the Microsoft Excel Add-In Manager. The user can also put DLL files in the Microsoft Excel Startup directory so that they are opened at run time. By convention, stand-alone DLLs are called XLLs. After the DLL is built, the DLL should be given a filename with the extension .XLL. When using an XLL, the user never sees a macro sheet or Add-In sheet. Therefore, an XLL must be able to do everything an XLA (Add-In) can do. In particular, XLLs need a way to provide functions that run automatically at open time, close time, and so on. When developing an XLL, you need to:


 * Define the interface to Microsoft Excel. An XLL should export a few functions that are called by Microsoft Excel and the Microsoft Excel Add-In Manager.
 * Define the user interface to the XLL. Does the XLL use pull-down menus, toolbars, or shortcut keys? Or does it only provide additional functions for use on worksheets?

The Generic Template for XLLs
The sample code provided contains a template you can use for writing your own 32-bit Microsoft Excel XLLs. This code demonstrates many of the features of the Microsoft Excel C API. To see the generic Add-In code, open GENERIC.C from the sample. When the compiled generic Add-In, GENERIC.XLL, is opened in Microsoft Excel, it creates a new Generic menu with the four Commands listed in the following table:

  Command            Action ---

Dialog            Displays a Microsoft Excel dialog box Dance             Moves the selection around until you press ESC Native Dialog     Displays a Windows dialog box that was created using the Windows API Exit              Closes GENERIC.XLL and removes the menu

The generic Add-In also provides two functions, Func1 and FuncSum, that can be used whenever the generic Add-In is open. These functions appear in the Generic Add-In category in the Function Wizard. Also, these functions can be registered without loading all of the generic Add-In. To do this, use the following formulas:

  =REGISTER("GENERIC.XLL","FUNC1") =REGISTER("GENERIC.XLL","FUNCSUM")

To Build
This project must be built as a 32-bit application. NMAKE can be used with the attached makefile to build this project.

