//-------------------------------------------------------
// 企业管理平台开发项目(开源)
// 发起人:陈玉有
// QQ:12092873
// 最后更新:2005-2-21
// 备注:在模块中使用功能图标,需要在工程中添加相应的资源文件
//------------------------------------------------------------
#include <vcl.h>
#include <windows.h>
#include <ADODB.hpp>
#include <Db.hpp>
#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.
//
// If your DLL uses the dynamic version of the RTL, you do not need to
// explicitly add MEMMGR.LIB as this will be done implicitly for you
//----------------------------------------------------------
#pragma argsused
#include "Unit2.h"//MDI子窗口TForm2的头文件,此处用于演示
const int ModuleID=202;
const int VersionID=1;
const AnsiString ModuleName="模块名称";
const AnsiString Author="作者";
const AnsiString ModuleHite="这是模块的简介";
const int FuncCount=1;
const AnsiString BuildDate="2005-02-20";
const bool ConnectDataSource=true;
HINSTANCE hI;
TADOConnection *Ado;
TApplication *ThisApp;
typedef struct FunctionInfo
{
char Caption[20];//标题,用于显示在菜单条上
char Hite[100];//提示,用于显示在状态栏
int SmallImageID;//小图标的资源 ID,0为无图标
int LargeImageID;//大图标的资源 ID,0为无图标
}FuncInfo;
FuncInfo Funs[1];
extern "C" __declspec(dllexport) AnsiString GetModuleName(); //导出模块名称
extern "C" __declspec(dllexport) AnsiString GetModule(); //导出模块说明
extern "C" __declspec(dllexport) int GetModuleID(); //导出模块ID
extern "C" __declspec(dllexport) AnsiString GetAuthor();//导出作者姓名
extern "C" __declspec(dllexport) int GetVerID();//导出版本代号
extern "C" __declspec(dllexport) AnsiString GetBuildDate(); //导出创建日期
extern "C" __declspec(dllexport) int GetFuncCount();//导出模块中的调用功能数
extern "C" __declspec(dllexport) bool GetFuncInfo(FuncInfo &Fi,int i); //导出第 i 个调用功能的信息
extern "C" __declspec(dllexport) void Run(int i,AnsiString Params); //带参数调用第 i 个功能
extern "C" __declspec(dllexport) bool UseConnection();//是否使用数据连接
extern "C" __declspec(dllexport) void SetConnection(TADOConnection *);//将主控程序的数据连接传入到 Dll 中。
extern "C" __declspec(dllexport) void SetMain(TApplication *App);//设置主程序
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
switch (reason)
{
case DLL_PROCESS_ATTACH:
hI=hinst;
strcpy(Funs[0].Caption,"导入代扣款");
strcpy(Funs[0].Hite,"导入为相关部门代扣的款项");
Funs[0].SmallImageID = 1;
Funs[0].LargeImageID = 2;
break;
case DLL_PROCESS_DETACH:
ThisApp=NULL;
Ado=NULL;
break;
}
return 1;
}
//---------------------------------------------------------------------------
/*
功能:获取模块名称
返回:模块名称 AnsiString
*/
AnsiString GetModuleName()
{
return ModuleName;
}
//---------------------------------------------------------------------------
/*
功能:获取模块名称
返回:模块名称 AnsiString
*/
AnsiString GetModule()
{
return ModuleHite;
}
//---------------------------------------------------------------------------
/*
功能:获得模块 id
返回:AnsiString
*/
int GetModuleID()
{
return ModuleID;
}
//---------------------------------------------------------------------------
/*
功能:获得作者姓名
返回:AnsiString
*/
AnsiString GetAuthor()
{
return Author;
}
//---------------------------------------------------------------------------
/*
功能:获得生成日期
返回:AnsiString
*/
AnsiString GetBuildDate()
{
return BuildDate;
}
//---------------------------------------------------------------------------
/*
功能:获得功能数量
返回:int
*/
int GetFuncCount()
{
return FuncCount;
}
//---------------------------------------------------------------------------
/*
功能:获得指定功能信息
返回:bool
参数:FuncInfo 导出, i 导入
*/
bool GetFuncInfo(FuncInfo &Fi,int i)
{
return true;
}
//---------------------------------------------------------------------------
/*
功能:获得默认功能信息
返回:bool
参数:FuncInfo 导出
*/
bool GetFuncInfo(FuncInfo &Fi)
{
return true;
}
//---------------------------------------------------------------------------
/*
功能:启动功能
返回:void
*/
void Run(int i,AnsiString Params)
{
//TODO :添加功能内容;
if (ThisApp!=NULL)//此处演示功能启动后显示一个MDI子窗口
{
TForm2 *MForm=new TForm2(ThisApp-MainForm);
MForm-Show();
}
//此处创建的MDI子窗口,要求在窗口的Close事件中设置Acitve=acFree;,以保证窗口能够正确关闭
}
//---------------------------------------------------------------------------
/*
功能:是否使用数据连接
返回:bool
*/
bool UseConnection()
{
return ConnectDataSource;
}
//---------------------------------------------------------------------------
/*
功能:设置数据库连接
返回:void
*/
void SetConnection(TADOConnection *Connection)
{
Ado=Connection;
}
//---------------------------------------------------------------------------
/*
功能:设置主程序
返回:void
*/
void SetMain(TApplication *App)
{
ThisApp=App;
}