WEB开发网
开发学院软件开发VC 在ActiveX控件中如何动态调用DLL函数 阅读

在ActiveX控件中如何动态调用DLL函数

 2006-07-21 11:44:18 来源:WEB开发网   
核心提示: 在类中我就写了这几个方法,在说一下我要输出的接口方法有:Init(short nCom)初化接口,在ActiveX控件中如何动态调用DLL函数(2),为调用做准备,Quit()退出程序时,调用它退出接口调用,ModifyPosDT(BSTR bstrDT)设置POS机时间

在类中我就写了这几个方法。

在说一下我要输出的接口方法有:
Init(short nCom)----初化接口,为调用做准备。
Quit()----退出程序时,调用它退出接口调用。
ModifyPosDT(BSTR bstrDT)----设置POS机时间。
EmptyPos()----清空POS机数据。

完了就这么多。
现在来看看我的源程序吧!
// PosCtrl.cpp : Implementation of CPosCtrl

#include "stdafx.h"
#include "PosActiveX.h"
#include "PosCtrl.h"
//--------------------------------------------------------
// Police.dll所用到的常量定义
//--------------------------------------------------------
#define Com_UpRecord 1
#define Com_UpPoliceLen 2
#define Com_UpSimpleDataLen 3
#define Com_UpSimplePunishLen 4
#define Com_UpGeneralDataLen 5
#define Com_UpGeneralPunishLen 6
#define Com_EmptyPolice 7
#define Com_EmptySimpleData 8
#define Com_EmptySimplePunish 9
#define Com_EmptyGeneralData 10
#define Com_EmptyGeneralPunish 11
#define Com_DownRecord 0x80
#define Com_DownStreetCodeLen 0x81
#define Com_DownBlackListLen 0x82
#define Com_DownPeccancySimpleLen 0x83
#define Com_DownPeccancyGeneralLen 0x84
#define Com_DownDateTime 0x85
#define Com_Exit 0x86
#define Com_Init 0x87
#define Err_UpSimpleDataLen 0
#define Err_UpSimplePunishLen 1
#define Err_UpGeneralDataLen 2
#define Err_UpGeneralPunishLen 3
#define Err_UpPoliceLen 4
#define Err_UpRecord 5
#define Err_DownStreetCodeLen 6
#define Err_DownSimplePeccancyCodeLen 7
#define Err_DownGeneralPeccancyCodeLen 8
#define Err_DownBlackList 9
#define Err_DownDateTime 10
#define Err_EmptyData 11
#define Err_GetCode 12;
#define Const_Terminator 0x20
#pragma data_seg("mydata")
static HINSTANCE DLLInst = NULL; //动态库句柄
#pragma data_seg() //
HANDLE hCom; //COM串口句柄
//------------------------------------------------------
//POLICE.DLL动态库函数功能定义
//------------------------------------------------------
HANDLE (__stdcall *Init_comm)(LPSTR str);//初始化通信口
BYTE (__stdcall *Exit)(HANDLE hCom);//关闭通信口
BYTE (__stdcall *Protocol)(HANDLE hCom,BYTE cmd,BYTE len,BYTE *_dt,BYTE *prlen,BYTE *prdt);//通信协议
BYTE (__stdcall *Pipe_control)(HANDLE hCom,BYTE mode);//多路控制typedef
BYTE (__stdcall *Dev_escape)(HANDLE hCom);//断开多路控制

//----------------------------------------------------------------------------//
// 功能:加载Police.dll动态库和其中的一些功能函数
// 输入/输出参数:无
// 版本:1.0
// 修改:
//----------------------------------------------------------------------------//

上一页  1 2 3 4 5 6  下一页

Tags:ActiveX 控件 如何

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接