VC写的DLL中有如下三个内容::3. Search IC:
int WINAPI Inventory(uc8* buf,us8 &count,us8 timeout);
uc8 buf[128];
us8 cnt = 5;
ret = _Inventory(buf,cnt,500);//Timeout500
The cnt is IC Count while return OK, ID length is 8 and ID has been save to buf4. Read Simply Block:
int WINAPI ReadSingleBlock(uc8* buf,byte block,us8 opmode);
Description:
Block: block index of IC //0~63
Opmode: mode of operate
Use:
if(mode == AddressMode)
{
uc8 dat[ID_LENGTH];
..//ID length is 8
ret = _ReadSingleBlock(dat,0,mode);
if(ret==RET_OK)
{
Recive block data to dat, the data length is SINGLE_BLOCK_SIZE//
}
}
else
{
uc8 dat[SINGLE_BLOCK_SIZE];
memset(dat,0,SINGLE_BLOCK_SIZE);
ret = _ReadSingleBlock(dat,cmbBlock->ItemIndex,mode);
if(ret==RET_OK)
{
//other
}
}5. Write simply Block:
int WINAPI WriteSingleBlock(uc8* id,uc8* buf,byte block,us8 opmode);
Description:
Id: IC 的ID
Block: block index of IC //0~63
Opmode: mode of operate
Use:
us8 mode = … ;
if(mode == AddressMode)
{
uc8 id[ID_LENGTH];
uc8 dat[ID_LENGTH];
memset(id,0,ID_LENGTH );
memset(dat,0,SINGLE_BLOCK_SIZE);
ret = _WriteSingleBlock(id,dat,block,mode); //need ID
}
else
{
uc8 dat[SINGLE_BLOCK_SIZE];
memset(dat,0,SINGLE_BLOCK_SIZE);
HexToBin2(edtData->Text,dat);
ret = _WriteSingleBlock(NULL,dat, block,mode); // needlessness ID}
请问在delphi中怎么调用啊???????????
求组各位大哥 在线等答案~~~

解决方案 »

  1.   

    uc8是什么类型? Unssigned Char?
    us8? unssigned short?type
      uc8 = UCHAR;
      pUC8 = ^uc8;
      us8 = WORD;
      pUS8 = ^us8;function Inventory(buf: pUC8; var count: us8; timeout: us8): Integer; stdcall; external 'yourDllName.dll';
    function ReadSingleBlock(buf: pUC8; block: Byte; opmode: us8): Integer;  stdcall; external 'yourDllName.dll';
    function WriteSingleBlock(id, buf: pUC8; block: Byte,opmode: us8): Integer;  stdcall; external 'yourDllName.dll';
      

  2.   

    #define uc8 unsigned char
    #define us8 unsigned short
    #define ul32 unsigned long