delphi如何调用c#的dll?
有一个名为EncroptDLL.dll的动态链接库,用C#写的,想在delphi中掉用它,该怎么弄?有没有类似的代码和例子呀,要通过编译和运行的!...
有一个名为EncroptDLL.dll的动态链接库,用C#写的,想在delphi中掉用它,该怎么弄?有没有类似的代码和例子呀,要通过编译和运行的!
展开
1个回答
展开全部
'MWIC_32.dll'这是我的程序调用的动态连接库,下面是个我做的系统中写好的代码,对你仅作为参考~
unit U_Public_Define;
interface
//用户卡操作函数
function swr_4442(icdev: longint;offset:smallint;length:smallint;data1:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'swr_4442';
function srd_4442(icdev: longint;offset:smallint;length:smallint; data1:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'srd_4442';
function prd_4442(icdev: longint;length:smallint;data1:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'prd_4442';
function pwr_4442(icdev: longint;offset:smallint;length:smallint;data1:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'pwr_4442';
function chk_4442(icdev: longint):smallint;stdcall;
far;external 'MWIC_32.dll'name 'chk_4442';
function csc_4442(icdev: longint;length:smallint;password:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'csc_4442';
function wsc_4442(icdev: longint;length:smallint; password:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'wsc_4442';
function rsc_4442(icdev: longint;length:smallint; password:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'rsc_4442';
function rsct_4442(icdev: longint;counter:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'rsct_4442';
//用户设备函数
function swr_eeprom(icdev: longint;offset:smallint;length:smallint; data1:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'swr_eeprom';
function srd_eeprom(icdev: longint;offset:smallint;length:smallint;data2:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'srd_eeprom';
function ic_init(port: smallint;baud:longint): longint; stdcall;
far;external 'MWIC_32.DLL' name 'ic_init';
function auto_init(port: smallint;baud:longint): longint; stdcall;
far;external 'MWIC_32.DLL' name 'auto_init';
function ic_exit(icdev: longint):smallint;stdcall;
far;external 'MWIC_32.dll' name 'ic_exit';
function get_status(icdev: longint;status:pchar):smallint;stdcall;
far;external 'MWIC_32.dll' name 'get_status';
function cmp_dvsc(icdev:longint;length:smallint;password:pchar):smallint;stdcall;
far;external 'MWIC_32.dll' name 'cmp_dvsc';
function setsc_md(icdev: longint;mode:smallint):smallint;stdcall;
far;external 'MWIC_32.dll'name 'setsc_md';
function srd_dvsc(icdev: longint;length:smallint;password:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'srd_dvsc'
function swr_dvsc(icdev: longint;length:smallint;password:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'swr_dvsc';
function turn_off(icdev: longint):smallint;stdcall;
far;external 'MWIC_32.dll'name 'turn_off';
function turn_on(icdev: longint):smallint;stdcall;
far;external 'MWIC_32.dll'name 'turn_on';
function auto_pull(icdev: longint):smallint;stdcall;
far;external 'MWIC_32.dll'name 'auto_pull';
function srd_ver(icdev: longint;length:smallint;ver:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'srd_ver';
function dv_beep(icdev: longint;time:smallint):smallint;stdcall;
far;external 'MWIC_32.dll'name 'dv_beep';
function ic_encrypt(key:pchar;source:pchar;len:smallint;dest:pchar):smallint;
stdcall;far;external 'MWIC_32.dll'name 'ic_encrypt';
function ic_decrypt(key:pchar;dest:pchar;len:smallint;source:pchar):smallint;
stdcall;far;external 'MWIC_32.dll'name 'ic_decrypt';
// operate sle 4428
function swr_4428(icdev: longint;offset:smallint;length:smallint;data1:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'swr_4428';
function srd_4428(icdev: longint;offset:smallint;length:smallint; data1:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'srd_4428';
function chk_4428(icdev: longint):smallint;stdcall;
far;external 'MWIC_32.dll'name 'chk_4428';
function rdwpb_4428(icdev: longint;offset:smallint;length:smallint;data1:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'rdwpb_4428';
function wrwpb_4428(icdev: longint;offset:smallint;length:smallint;data1:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'wrwpb_4428';
function wpr_4428(icdev: longint;offset:smallint;length:smallint;data1:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'wpr_4428';
function asc_hex(asc:pchar;hex:pchar;len:smallint):smallint;stdcall;
far;external 'MWIC_32.dll'name 'asc_hex';
function hex_asc(hex:pchar;asc:pchar;len:smallint):smallint;stdcall;
far;external 'MWIC_32.dll'name 'hex_asc';
function csc_4428(icdev: longint;length:smallint;password:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'csc_4428';
function wsc_4428(icdev: longint;length:smallint; password:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'wsc_4428';
function rsc_4428(icdev: longint;length:smallint; password:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'rsc_4428';
function rsct_4428(icdev: longint;counter:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'rsct_4428';
var
G_icdev:longint; //
G_St:integer; //返回值
G_Str_JBxx:string;//基本信息表ID名称
G_Str_selectKh:string;//选择的编号
G_str_SelectBh:string;
G_Str_Name:string;//管理人员名称
G_Bool_DLok:Boolean;//登录成功
//高级下的定义数据
G_Gj_Ckh:integer;//串口号
G_Gj_Ckys:integer;//串口延时
G_Gj_Zdjh:integer;//最大延时
G_Gj_KxzhYj:real; //开新账户押金
G_Gj_HkGdFy:Real; //换卡固定费用
G_Gj_RxfLjXe:real;//日消费累计限额
G_Gj_RxfljXc:real; //日消费累计限次
G_GJ_BoolBf:boolean; //退出系统时备份
G_Gj_BoolJhkz:boolean; //进行机号控制
G_Gj_BoolXe:boolean; //进行限额控制
G_Gj_BoolXc:boolean; //进行限次控制
implementation
end.
unit U_Public_Define;
interface
//用户卡操作函数
function swr_4442(icdev: longint;offset:smallint;length:smallint;data1:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'swr_4442';
function srd_4442(icdev: longint;offset:smallint;length:smallint; data1:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'srd_4442';
function prd_4442(icdev: longint;length:smallint;data1:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'prd_4442';
function pwr_4442(icdev: longint;offset:smallint;length:smallint;data1:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'pwr_4442';
function chk_4442(icdev: longint):smallint;stdcall;
far;external 'MWIC_32.dll'name 'chk_4442';
function csc_4442(icdev: longint;length:smallint;password:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'csc_4442';
function wsc_4442(icdev: longint;length:smallint; password:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'wsc_4442';
function rsc_4442(icdev: longint;length:smallint; password:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'rsc_4442';
function rsct_4442(icdev: longint;counter:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'rsct_4442';
//用户设备函数
function swr_eeprom(icdev: longint;offset:smallint;length:smallint; data1:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'swr_eeprom';
function srd_eeprom(icdev: longint;offset:smallint;length:smallint;data2:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'srd_eeprom';
function ic_init(port: smallint;baud:longint): longint; stdcall;
far;external 'MWIC_32.DLL' name 'ic_init';
function auto_init(port: smallint;baud:longint): longint; stdcall;
far;external 'MWIC_32.DLL' name 'auto_init';
function ic_exit(icdev: longint):smallint;stdcall;
far;external 'MWIC_32.dll' name 'ic_exit';
function get_status(icdev: longint;status:pchar):smallint;stdcall;
far;external 'MWIC_32.dll' name 'get_status';
function cmp_dvsc(icdev:longint;length:smallint;password:pchar):smallint;stdcall;
far;external 'MWIC_32.dll' name 'cmp_dvsc';
function setsc_md(icdev: longint;mode:smallint):smallint;stdcall;
far;external 'MWIC_32.dll'name 'setsc_md';
function srd_dvsc(icdev: longint;length:smallint;password:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'srd_dvsc'
function swr_dvsc(icdev: longint;length:smallint;password:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'swr_dvsc';
function turn_off(icdev: longint):smallint;stdcall;
far;external 'MWIC_32.dll'name 'turn_off';
function turn_on(icdev: longint):smallint;stdcall;
far;external 'MWIC_32.dll'name 'turn_on';
function auto_pull(icdev: longint):smallint;stdcall;
far;external 'MWIC_32.dll'name 'auto_pull';
function srd_ver(icdev: longint;length:smallint;ver:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'srd_ver';
function dv_beep(icdev: longint;time:smallint):smallint;stdcall;
far;external 'MWIC_32.dll'name 'dv_beep';
function ic_encrypt(key:pchar;source:pchar;len:smallint;dest:pchar):smallint;
stdcall;far;external 'MWIC_32.dll'name 'ic_encrypt';
function ic_decrypt(key:pchar;dest:pchar;len:smallint;source:pchar):smallint;
stdcall;far;external 'MWIC_32.dll'name 'ic_decrypt';
// operate sle 4428
function swr_4428(icdev: longint;offset:smallint;length:smallint;data1:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'swr_4428';
function srd_4428(icdev: longint;offset:smallint;length:smallint; data1:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'srd_4428';
function chk_4428(icdev: longint):smallint;stdcall;
far;external 'MWIC_32.dll'name 'chk_4428';
function rdwpb_4428(icdev: longint;offset:smallint;length:smallint;data1:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'rdwpb_4428';
function wrwpb_4428(icdev: longint;offset:smallint;length:smallint;data1:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'wrwpb_4428';
function wpr_4428(icdev: longint;offset:smallint;length:smallint;data1:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'wpr_4428';
function asc_hex(asc:pchar;hex:pchar;len:smallint):smallint;stdcall;
far;external 'MWIC_32.dll'name 'asc_hex';
function hex_asc(hex:pchar;asc:pchar;len:smallint):smallint;stdcall;
far;external 'MWIC_32.dll'name 'hex_asc';
function csc_4428(icdev: longint;length:smallint;password:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'csc_4428';
function wsc_4428(icdev: longint;length:smallint; password:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'wsc_4428';
function rsc_4428(icdev: longint;length:smallint; password:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'rsc_4428';
function rsct_4428(icdev: longint;counter:pchar):smallint;stdcall;
far;external 'MWIC_32.dll'name 'rsct_4428';
var
G_icdev:longint; //
G_St:integer; //返回值
G_Str_JBxx:string;//基本信息表ID名称
G_Str_selectKh:string;//选择的编号
G_str_SelectBh:string;
G_Str_Name:string;//管理人员名称
G_Bool_DLok:Boolean;//登录成功
//高级下的定义数据
G_Gj_Ckh:integer;//串口号
G_Gj_Ckys:integer;//串口延时
G_Gj_Zdjh:integer;//最大延时
G_Gj_KxzhYj:real; //开新账户押金
G_Gj_HkGdFy:Real; //换卡固定费用
G_Gj_RxfLjXe:real;//日消费累计限额
G_Gj_RxfljXc:real; //日消费累计限次
G_GJ_BoolBf:boolean; //退出系统时备份
G_Gj_BoolJhkz:boolean; //进行机号控制
G_Gj_BoolXe:boolean; //进行限额控制
G_Gj_BoolXc:boolean; //进行限次控制
implementation
end.
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询