1.装人口信息系统接口软件
2.程序-人口信息系统接口软件- 右键delphitest 属性 -寻找目标 -开发包-termb.dll、WltRS.dll 考到开发文件debug里
3代码如下:
using System.Runtime.InteropServices;
using System.Text;
[DllImport("termb.dll", EntryPoint = "InitComm")]
static extern int InitComm(int Port);
[DllImport("termb.dll", EntryPoint = "CloseComm")]
static extern int CloseComm();
[DllImport("termb.dll", EntryPoint = "Read_Content")]
static extern int Read_Content(int Active);
[DllImport("termb.dll", EntryPoint = "GetPeopleName")]
static extern int GetPeopleName(StringBuilder strbl, int strLen);
[DllImport("termb.dll", EntryPoint = "Authenticate")]
static extern int Authenticate();
private void button1_Click(object sender, EventArgs e)
{
int li_ret = 0;
int li_port = 1001;
li_ret = InitComm(li_port);
int at = Authenticate();
Read_Content(1);
StringBuilder strbl = new StringBuilder();
int strLen = 30;
GetPeopleName(strbl, strLen);
int cl = CloseComm();
}