ls正解
使用
lstrcpy(sReturn, s);vb中
dim   sReturn   as   string 
要先分配空间。或使用数组。

解决方案 »

  1.   

    GetBarcodeA(LPCTSTR   sDirectory,LPCTSTR   sReturn,int   nMode) 
    你这个外部接口少了一个参数用来说明sReturn的内存长度否则
    memcpy/memmove将导致内存访问违规。
      

  2.   

    你这种用法会有问题。看你内部的代码好像使用的是ANSI编译选项,而vb中的sReturn的类型是String,这是UNICODE类型的,所以需要进行转换。要么把GetBarcodeA(LPCTSTR   sDirectory,LPCTSTR   sReturn,int   nMode) 改成 GetBarcodeA(LPCTSTR   sDirectory,LPCWSTR   sReturn,int   nMode);要么把sReturn的类型改成Byte()。