我有一動態庫12.dll,其函數說明為如下:1.HANDLE OpenCfgComm ( short nPort,char* pSetting )
 函數說明:打開串口
 nPort:串口號,1表示COM1,2表示COM2...; 
 pSetting:串口初始化值,設爲"9600,n,8,1";
 返回:串口控制碼(長整型);2.void CloseCfgComm( HANDLE hComm )
 函數說明:關閉串口;
 hComm: 串口控制碼;
 返回:無;
請求怎樣用delphi來實現,最好舉例子

解决方案 »

  1.   

    uses..... System,Windows;
    const
      DllFile = 12.dll';function OpenCfgComm ( nPort:Smallint, pSetting:PChar ):THandle;stdcall; external DllFile;
    procedure CloseCfgComm( hComm:THandle);external DllFile;
      

  2.   

    Windows单元理定义了很多兼容C++里面的类型
    function OpenCfgComm ( nPort:short, pSetting:PChar ):THandle;stdcall; external DllFile;
    procedure CloseCfgComm( hComm:THandle);external DllFile;
      

  3.   

    function OpenCfgComm(nPort : smallint;pSetting PChar) : longint;stdcall;
    external 'l2.dll' name 'OpenCfgcomm';
    procedure CloseCfgComm(hComm : Handle);stdcall;
    external 'l2.dll' name 'CloseCfgComm';