Get Barcode data and type from system buffer. BOOL PT_GetBarcodeData
{
UINT * uiBarType,
Char * pBuffer,
UINT * uiMaxBufferLen
}
Parameters:
uiBarType [out] barcode type.
pBuffer [out] buffer for storing scanned data.
uiMaxBufferLen [in/out] The max buffer size Return Values Return TRUE if the operation is successful, otherwise return FALSE.Res If the buffer size is less than scan data, function return 0 and the parameter uiMaxBufferLen return the size of barcode data. Example:if(PT_CheckBarcodeData())
{
if(PT_GetBarcodeData(&uiBarType, pBarData, &uiMaxLen))
{
for(i = 0 ; i < strlen(pBarData) ; i++)
m_strScanData += *(pBarData + i);
}
else m_strScanData = _T("Can't get scan data");
}
else m_strScanData = _T("No Scan Data");
关于PT60扫描枪C++代码,网上查了资料转,有个换成C#代码的版本:[DllImport("scanapiax.dll", EntryPoint = "PT_GetBarcodeData")]
public static extern bool PT_GetBarcodeData(ref uint uiBarType, byte[] pBuffer, ref uint uiMaxBufferLen);
应该是返回扫描枪扫描的数据,不知道怎么用,怎么调用。
ref uint uiBarType, byte[] pBuffer, ref uint uiMaxBufferLen 这参数也看不明白,是如何返回值的。
求各位高手帮忙。
{
UINT * uiBarType,
Char * pBuffer,
UINT * uiMaxBufferLen
}
Parameters:
uiBarType [out] barcode type.
pBuffer [out] buffer for storing scanned data.
uiMaxBufferLen [in/out] The max buffer size Return Values Return TRUE if the operation is successful, otherwise return FALSE.Res If the buffer size is less than scan data, function return 0 and the parameter uiMaxBufferLen return the size of barcode data. Example:if(PT_CheckBarcodeData())
{
if(PT_GetBarcodeData(&uiBarType, pBarData, &uiMaxLen))
{
for(i = 0 ; i < strlen(pBarData) ; i++)
m_strScanData += *(pBarData + i);
}
else m_strScanData = _T("Can't get scan data");
}
else m_strScanData = _T("No Scan Data");
关于PT60扫描枪C++代码,网上查了资料转,有个换成C#代码的版本:[DllImport("scanapiax.dll", EntryPoint = "PT_GetBarcodeData")]
public static extern bool PT_GetBarcodeData(ref uint uiBarType, byte[] pBuffer, ref uint uiMaxBufferLen);
应该是返回扫描枪扫描的数据,不知道怎么用,怎么调用。
ref uint uiBarType, byte[] pBuffer, ref uint uiMaxBufferLen 这参数也看不明白,是如何返回值的。
求各位高手帮忙。
解决方案 »
- C#操作临时表
- 请教各位大虾~如何获得windows所有groups 的sid??
- 用C# 调用winAPI的 settimer()后,不执行回调函数!! 具体程序如下:
- sql 数据类型 急!!!!
- Listbox内的item怎么读入数据库啊 ?
- 问一个关于窗体关闭的问题?
- 去掉粘贴板上的html标记。但保留img 和h1,h2,h3,h4 以及整个table
- 多文档程序,如何在上方以选项卡形式出现
- 关于sqlite在C#中的应用
- 在TreeView里面的一段VB代码,想改成C#!!!!
- webBrowser控件如何直接显示word文档,而不是在本地的word程序中打开?
- ComponentOne C1Chart 改变单个数据点的样式问题
http://blog.csdn.net/sunboyljp/article/details/5110639
该怎么用啊?
byte[] buffer = new byte[50];
uint uiMaxBufferLen = (uint)buffer.Length; bool bSuccess = PT_GetBarcodeData(ref uiBarType, buffer, ref uiMaxBufferLen); if (bSuccess)
{
Console.Write("成功!条码类型为:{0},扫描数据为:", uiBarType);
foreach (byte ch in buffer)
{
if (ch == 0) //零表示结束
break;
Console.Write(" {0}", ch);
}
}
else
{
Console.Write("失败!需要的缓冲区长度为:{0}字节", uiMaxBufferLen);
}