/ / -------------------------------------------------------------------------------------------- ------- // Enterprise Management Platform Development Project (Open Source) // Sponsor: Chen Yu has // QQ: 12092873 // Last updated: 2005-2-21 // Note: Use function icons in the module Need to add a corresponding resource file in the project // ------------------------------------ ----------------------
#include
#include
#include
#include
#pragma HDRSTOP
/ / -------------------------------------------------------------------------------------------- ------- // Important Note About DLL MEMORY Management WHEN YOUR DLL Uses The // Static Version of the Runtime Library: // // If Your DLL Exports Any Functions That Pass String Objects (or Structs / // Classes containing nested Strings) as parameter or function results, // you will need to add the library MEMMGR.LIB to both the DLL project and // any other projects that use the DLL. you will also need to use MEMMGR.LIB // if any other projects which use the DLL will be performing new or delete // operations on any non-TObject-derived classes which are exported from the // DLL. Adding MEMMGR.LIB to your project will change the DLL and its calling // EXE's to use the BORLNDMM.DLL as their memory manager. In these cases, // the file BORLNDMM.DLL should be deployed along with your DLL. // // to avoid using BORLNDMM.DLL, pass string information using "char *" or // shortstring parameters. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////Ww Your DLL Uses The Dynamic Version of The RTL, You do not need need to // evlicitly add memmgr.lib as this will be done ptitly for you // ------------------------------------------------------------------------------------------------------ ------------------------------
#pragma argsused
#include "unit2.h"
// MDI sub-window TFORM2 header file, this is used to demonstrate
Const int moduleId = 202;
Const int versionID = 1;
Const Ansistring Modulename = "Module Name";
Const Ansistring Author = "Author"; const anstring modulehite = "This is a module";
Const int funccount = 1;
Const Ansistring Builddate = "2005-02-20";
Const Bool ConnectDataSource = True;
Hinstance hi;
Tadoconnection * ADO;
TAPPLICATION * THISAPP;
Typedef struct functionInfo
{
Char capen [20];
// Title, used to display on the menu bar
Char Hite [100];
// Tip, used to display in the status bar
Int smallimageid;
// Small icon resource ID, 0 is no icon
Int largeimageId;
// large icon resource ID, 0 is no icon
} Funcinfo;
Funcinfo Funs [1];
Extern "C" __declspec (dllexport) Ansistring getModulenAme ();
// Export module name
EXTERN "C" __DECLSPEC (DLLEXPORT) ANSISULE ();
// Export module description
EXTERN "C" __DECLSPEC (DLLEXPORT) INT getModuleId ();
// Export Module ID
EXTERN "C" __DECLSPEC (DLLEXPORT) ANSISUTRING GETAUTHOR ();
// Export the author's name
EXTERN "C" __declspec (dllexport) INT getverid ();
/ / Guide the version of the code
Extern "C" __declspec (dllexport) Ansistring getBuilddate ();
/ / Export Creative Date
EXTERN "C" __DECLSPEC (DLLEXPORT) INT getFunccount ();
/ / Export number of call functions in the module
Extern "C" __declspec (dllexport) Bool getFuncinfo (Funcinfo & Fi, Int i);
/ / Export information about the Issue I call function
Extern "C" __DECLSPEC (DLLEXPORT) Void Run (INT I, ANSISTRING PARAMS);
// Tape parameter calling the i-th function
EXTERN "C" __DECLSPEC (DLLEXPORT) BOOL UseConnection ();
/ / Whether to use data connection
Extern "c" __declspec (dllexport) void setConnection; Tadoconnection *);
// Incorporate the data connection of the master program into the DLL.
EXTERN "C" __DECLSPEC (DLLEXPORT) Void SetMain (Tapplication * APP);
// Set the main program
Int WinApi DLLENTRYPOINT (Hinstance Hinst, Unsigned Long Reason, Void * LPRESERVED)
{
Switch (REASON)
{
Case DLL_Process_attach:
Hi = hinst;
STRCPY (FUNS [0] .caption, "Import Bundry");
STRCPY (FUNS [0]. Hite, "Import for the payment of relevant departments");
Funs [0] .smallimageId = 1; FUNS [0] .lageImageId = 2;
Break;
Case DLL_PROCESS_DETACH:
THISAPP = NULL;
ADO = NULL;
Break;
}
Return 1;
}
/ / -------------------------------------------------------------------------------------------- --------------------------- / * Function: Get Module Name Return: Module Name Ansistring * / Ansistring getModulenAme ()
{
Return modulename;
}
/ / -------------------------------------------------------------------------------------------- --------------------------- / * Function: Get Module Name Return: Module Name Ansistring * / Ansistring getModule ()
{
Return modulehite;
}
/ / -------------------------------------------------------------------------------------------- --------------------------- / * Function: Get Module ID Back: Ansistring * / Int getModuleId ()
{
Return ModuleId;
}
/ / -------------------------------------------------------------------------------------------- --------------------------- / * Function: Get the author's name Back: Ansistring * / Ansistring GetAuthor ()
{
Return Author;
}
/ / -------------------------------------------------------------------------------------------- --------------------------- / * Function: Get the generation date return: ANSISTRING * / ANSISTRING GETBUILDDATE ()
{
Return builddate;
}
/ / -------------------------------------------------------------------------------------------- --------------------------- / * Function: Get function Number Back: int * / int getFunccount ()
{
Return Funccount;
}
/ / -------------------------------------------------------------------------------------------- --------------------------- / * Function: Get the specified function information Back: BOOL parameters: funcinfo export, i import * / bool getfuncinfo Funcinfo & Fi, INT I)
{
Return True;
}
/ / -------------------------------------------------------------------------------------------- --------------------------- / * Function: Get the default function information Back: BOOL Parameters: Funcinfo Export * / Bool getFuncinfo (Funcinfo & Fi)
{
Return True;
}
/ / -------------------------------------------------------------------------------------------- --------------------------- / * Function: Start function return: void * / void Run (Int i, Ansistring params)
{
// Todo: Add function content;
IF (thisApp! = null)
// This demo function is displayed after the startup display a MDI sub-window
{
TFORM2 * MFORM =
New TFORM2 (THISAPP-> Mainform);
MFORM-> show ();
}
// The MDI sub-window created here, requires Acitve = Acfree in the window's Close event; to ensure that the window can close correctly
}
/ / -------------------------------------------------------------------------------------------- --------------------------- / * Function: Do you use a data connection to return: BOOL * / BOOL Useconnection () {
Return ConnectDataSource;
}
/ / -------------------------------------------------------------------------------------------- --------------------------- / * Features: Setting the database connection Return: void * / void setconnection (tadoconnection * connection)
{
ADO = Connection;
}
/ / -------------------------------------------------------------------------------------------- --------------------------- / * Function: Set the main program return: void * / void setmain (Tapplication * app)
{
THISAPP = app;
}