SAMPLE: FRMWRK32.EXE: Updated Generic.xll Template for Excel
ID: Q152152
|
The information in this article applies to:
-
Microsoft Excel Software Development Kit 5.0 for:
-
Microsoft Excel for Windows NT, version 5.0
-
Microsoft Excel 7.0
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 Software
Library:
~ Frmwrk32.exe
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
MORE INFORMATION
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.
REFERENCES
Microsoft Excel Developer's Kit, version 5.
Keywords : kbsample kbusage
Version : 4.0 3.5 3.51
Platform : NT WINDOWS
Issue type :
Last Reviewed: March 8, 1999