一共有十台刷卡机(MR350II),一个RS232/RS485接收转换器.
我现在从Unitech的官方网站下了DLL两个文件.有简单的说明.
说明如下
OnlineCom.DllThe OnlineCom control supports following functions:property, Ready
     return 1 = OnlineDll.Dll is loaded
     return 0 = OnlineDll.Dll is not loadedfunction, Wakeup(String)
     Send the String to wake up the portable/terminal
     no return valuefunction, Sleep(Milliseconds)
     make your calling thread Sleep for Milliseconds
     no return valuefunction, SetupEx(Port, BaudRate, StopBit, Parity)
     Set up the Windows communication port
     return 1 = successed
     return 0 = failedfunction, Connect()
     use the current settings to connect to the portable/terminal
     return 1 = successed
     return 0 = failedfunction, Disconnect()
     Disconnect from the portable/terminal
     no return valuefunction, GetVersion(Addr)
     Get the firmware version of portable/terminal Addr
     return 1 = successed, use GetVersion_Str to retreve the Version string
     return 0 = failedproperty, GetVersion_Str
     see GetVersion(Addr)
     return = Version stringfunction, ACK(Addr)
     Send ACK to portable/terminal
     no return valuefunction, NAK(Addr)
     Send NAK to portable/terminal
     no return valuefunction, GetFileLength(Addr, Filename)
     Get Filename's length on portable/terminal Addr
     return 6 = successed
     return 8 = successed and the Filename is in use
     use GetFileLength_Long to retreve the length when successed     return others = failedproperty, GetFileLength_Long
     see GetFileLength(Addr, Filename)
     return = Filename's length on portable/terminal Addrfunction, DeleteFile(Addr, Filename)
     Delete Filename on portable/terminal Addr
     return 6 = successed
     return others = failedfunction, FindFirst(Addr)
     Find files on portable/terminal Addr for the first time
     See FindNext(Addr)
     See FindName
     return 1 = successed
     return others = failedfunction, FindNext(Addr)
     Find files on portable/terminal Addr again
     See FindFirst(Addr)
     See FindName
     return 1 = successed
     return others = failedproperty, FindName
     Retrieve the latest found filename on portable/terminal Addr
     See FindFirst(Addr) and FindNext(Addr)
     return = filename
     note that when return value is zero length string, you should exit loop for findnextfunction, GetMemSize(Addr)
     Get memory's size on portable/terminal Addr
     See GetMemSize_Total
     See GetMemSize_Exec
     See GetMemSize_Free
     return 1 = successed
     return others = failedproperty, GetMemSize_Total
     Retrieve the total memory size on portable/terminal Addr
     See GetMemSize(Addr)
     return = total memory size in KB
property, GetMemSize_Exec
     Retrieve the executable memory size on portable/terminal Addr
     See GetMemSize(Addr)
     return = executable memory size in KB
property, GetMemSize_Free
     Retrieve the free space size on portable/terminal Addr
     See GetMemSize(Addr)
     return = free space size in KB
function, DnLoad(Addr, portableFilename, desktopFilename, Timeout, Retry)
     Start to transfer file from windows/desktop to portable/terminal Addr
     Timeout: default = 0
     Retry: suggest = 3
     See StLoad(Stop)
     return 1 = successed
     return others = failedfunction, UpLoad(Addr, desktopFilename, portableFilename, Timeout, Retry)
     Start to transfer file from portable/terminal Addr to windows/desktop
     Timeout: default = 0
     Retry: suggest = 3
     See StLoad(Stop)
     return 1 = successed
     return others = failedfunction, StLoad(Stop)
     If Stop=0, it check the current status of the file transfer
     If Stop=1, it force the current transfer be stopped
     See DnLoad(Addr, portableFilename, desktopFilename, Timeout, Retry)
     See UpLoad(Addr, desktopFilename, portableFilename, Timeout, Retry)
     See StLoad_sSize
     See StLoad_lSize
     return 1 = transfer is going on
     return others = failedproperty, StLoad_sSize
     See StLoad(Stop)
     return = current file's size on portable/terminalproperty, StLoad_lSize
     See StLoad(Stop)
     return = current file's size on windows/desktopfunction, WarmBoot(Addr)
     Warm boot portable/terminal Addr
     return 6 = successed
     return others = failedfunction, ColdBoot(Addr)
     This action will cause data lost on portable/terminal Addr
     Cold boot portable/terminal Addr
     return 6 = successed
     return others = failedfunction, Bell(Addr)
     Send bell command to portable/terminal Addr
     return 1 = get responsed successfully
     return others = failedfunction, Loop(Addr, Msg)
     Send Loop Msg to portable/terminal Addr
     See Loop_Str
     return 1 = get responsed successfully
     return others = failedproperty, Loop_Str
     See Loop(Addr, Msg)
     return = response string from portable/terminal Addrfunction, Send(Addr, Msg)
     Send Msg to portable/terminal Addr
     return 6 successed
     return others = failedfunction, Poll(Addr)
     Poll data from portable/terminal Addr
     You need to send ACK or NAK to portable/terminal after calling this function
     See Poll_Len and Poll_Str 
     return 1 = data received
     return 3 = no data received
     return others = failedproperty, Poll_Len
     See Poll(Addr)
     return = size of received data from portable/terminal Addrproperty, Poll_Str
     See Poll(Addr)
     return = data string received from portable/terminal Addrfunction, Run(Addr, Program)
     Run Program on portable/terminal Addr
     return 6 = successed
     return others = failedfunction, GetRunning(Addr)
     Get running program on portable/terminal Addr
     See GetRunning_Str
     return 1 = found running program
     return 9 = no program is running
     return others = failedproperty, GetRunning_Str
     See GetRunning(Addr)
     return = running program name on portable/terminal Addrfunction, SetDateTime(Addr, DateTimeString)
     Set DateTimeString to portable/terminal Addr
     DateTimeString uses this format: "YYYYMMDDhhmmss", YYYY for year, MM for month, DD for day, hh for hour, mm for minute, ss for second.
     return 6 = successed
     return others = failedfunction, SetCommport(Addr, Settings)
     Set Settings for communication port on portable/terminal Addr
     The settings may have different forms for different products
     return 6 = successed
     return others = failed

解决方案 »

  1.   

    OnlineDll.Dll
    {
    It is assumed that you have installed
    Online Comm Manager in the folder of
    C:\OnlineCommManagerOtherwise, you have to1. Copy OnlineDll.Dll to Windows or Windows\System folder,
       and remove the path specification
    or2. Copy OnlineDll.Dll to the same folder of your Exe file,
       and remove the path specificationor3. Manual modify the path in
       External 'C:\OnlineCommManager\OnlineDll.Dll'
    }
    unit OnlineDll;interfaceuses
      Windows;Const
        CmdOK        = 1; { Command OK }
        CmdEOT       = 2;
        CmdEOF       = 3;
        CmdACK       = 4;
        CmdNAK       = 5;
        CmdYES       = 6;
        CmdNO        = 7;
        CmdUSE       = 8;
        CmdNONE      = 9;
        CmdErr       = 128;
        CmdErrLen    = 129;
        CmdErrTime   = 130;
        CmdErrSocket = 131;
      

  2.   

    Type
        PBARCFG =^TBARCFG;
        TBARCFG = Record  { for ESC B Command }
            code39,       { 'N' = Enable  barcode decoding of Code 39 }
                          { 'F' = Disable barcode decoding of Code 39 }
            i2of5,        { 'N' = Enable  barcode decoding of Interleaved 2 of 5 }
                          { 'F' = Disable barcode decoding of Interleaved 2 of 5 }
            codabar,      { 'N' = Enable  barcode decoding of CODABAR }
                          { 'F' = Disable barcode decoding of CODABAR }
            ean_upc,      { 'N' = Enable  barcode decoding of UPC/EAN }
                          { 'F' = Disable barcode decoding of UPC/EAN }
            code128,      { 'N' = Enable  barcode decoding of Code 128}
                          { 'F' = Disable barcode decoding of Code 128}
            ean128,       { 'N' = Enable  barcode decoding of EAN 128 }
                          { 'F' = Enable  barcode decoding of EAN 128 }
            code93: Byte; { 'N' = Enable  barcode decoding of Code 93 }
                          { 'F' = Disable barcode decoding of Code 93 }
        End;    PBARCFG5=^TBARCFG5;
        TBARCFG5= Record  { for ESC B Command on PT500 }
            code39,       { 'N' = Enable  barcode decoding of Code 39 }
                          { 'a'..'h'                                  }
                          { 'F' = Disable barcode decoding of Code 39 }
            i2of5,        { 'N' = Enable  barcode decoding of Interleaved 2 of 5 }
                          { 'a'..'h'                                             }
                          { 'F' = Disable barcode decoding of Interleaved 2 of 5 }
            codabar,      { 'N' = Enable  barcode decoding of CODABAR }
                          { 'a'..'h'                                  }
                          { 'F' = Disable barcode decoding of CODABAR }
            ean_upc,      { 'N' = Enable  barcode decoding of UPC/EAN }
                          { 'a'..'p'                                  }
                          { 'F' = Disable barcode decoding of UPC/EAN }
            code128,      { 'N' = Enable  barcode decoding of Code 128}
                          { 'F' = Disable barcode decoding of Code 128}
            ean128,       { 'N' = Enable  barcode decoding of EAN 128 }
                          {  msi, 'a'..'c'                            }
                          { 'F' = Enable  barcode decoding of EAN 128 }
            code93,       { 'N' = Enable  barcode decoding of Code 93 }
                          { 'F' = Disable barcode decoding of Code 93 }
            code32,       { 'N' = Enable  barcode decoding of Code 32 }
                          { 'a'..'d'                                  }
                          { 'F' = Disable barcode decoding of Code 32 }
            chnpost:Byte; { 'N' = Enable  barcode decoding of China Postal Code }
                          { 'a'..'h'                                            }
                          { 'F' = Disable barcode decoding of China Postal Code }
        End;    PBARCFG6=^TBARCFG6;
        TBARCFG6= Record  { for ESC B Command on PT600 }
            code39,       { 'E' = Enable  barcode decoding of Code 39             }
                          { 'F' = Enable  barcode decoding of Code 39, Full ASCII }
                          { 'D' = Disable barcode decoding of Code 39             }
            i2of5,        { 'E' = Enable  barcode decoding of Interleaved 2 of 5 }
                          { 'D' = Disable barcode decoding of Interleaved 2 of 5 }
            codabar,      { 'E' = Enable  barcode decoding of CODABAR }
                          { 'D' = Disable barcode decoding of CODABAR }
            ean_upc,      { 'E' = Enable  barcode decoding of UPC/EAN }
                          { 'D' = Disable barcode decoding of UPC/EAN }
            code128,      { 'E' = Enable  barcode decoding of Code 128}
                          { 'D' = Disable barcode decoding of Code 128}
            ean128,       { 'E' = Enable  barcode decoding of EAN 128 }
                          { 'D' = Enable  barcode decoding of EAN 128 }
            code93: Byte; { 'E' = Enable  barcode decoding of Code 93 }
                          { 'D' = Disable barcode decoding of Code 93 }
        End;
      

  3.   

    PCOMCFG =^TCOMCFG;
        TCOMCFG = Record  { for ESC C Command
                           Always set 'M' to Protocol,
                           '04' to TimeOut, and 'C' to FlowCtrl. }
            BaudRate,     { '0' =   110 bps }
                          { '1' =   150     }
                          { '2' =   300     }
                          { '3' =   600     }
                          { '4' =  1200     }
                          { '5' =  2400     }
                          { '6' =  4800     }
                          { '7' =  9600     }
                          { '8' = 19200     }
                          { '9' = 38400     }
                          { 'A' = 57600     }
            StopBits,     { '1' = 1 Stop Bit  }
                          { '2' = 2 Stop Bits }
            DataBits,     { '7' = 7 Data Bits }
                          { '8' = 8 Data Bits }
            Parity,       { 'N' = None Parity }
                          { 'O' = Odd  Parity }
                          { 'E' = Even Parity }
            Protocol,     { 'M' = Multi-point protocol }
                          { 'F' = None protocol        }
            Address:      { 'A'..'Y', or '0'..'6' }
                          Byte;
            TimeOut:      { '00' = reserved }
                          Array [0..1] Of Byte;
            FlowCtrl:     { 'N' = None     }
                          { 'X' = Xon/Xoff }
                          { 'C' = CTS/RTS (effect with RS232 only)}
                          Byte;
        End;    PCOMCFG6=^TCOMCFG6;
        TCOMCFG6= Record  { for ESC C Command on PT600 }
            BaudRate,     { '0' =   110 bps }
                          { '1' =   150     }
                          { '2' =   300     }
                          { '3' =   600     }
                          { '4' =  1200     }
                          { '5' =  2400     }
                          { '6' =  4800     }
                          { '7' =  9600     }
                          { '8' = 19200     }
                          { '9' = 38400     }
                          { 'A' = 57600     }
            StopBits,     { '1' = 1 Stop Bit  }
                          { '2' = 2 Stop Bits }
            DataBits,     { '7' = 7 Data Bits }
                          { '8' = 8 Data Bits }
            Parity,       { 'N' = None Parity }
                          { 'O' = Odd  Parity }
                          { 'E' = Even Parity }
            FlowCtrl:     { 'N' = None     }
                          { 'X' = Xon/Xoff }
                          { 'C' = CTS/RTS  }
                          Byte;
            Protocol,     { 'M' = Multi-point protocol }
                          { 'F' = None protocol        }
            Address:      { 'A'..'Y', or '0'..'6' }
                          Byte;
            TimeOut:      { '000'= reserved }
                          Array [0..2] Of Byte;
        End;
      

  4.   

    晕,不知道你想问什么……
    但是有了dll文件和它的‘函数说明,那就再简单不过了,只需要调用其中的处理函数就可以了。