简体   繁体   English

Windows CE-RegisterWindowMessage WM_DECODEDATA不起作用

[英]Windows CE - RegisterWindowMessage WM_DECODEDATA doesn't work

I'm working on simple application for windows CE to scan barcodes. 我正在为Windows CE开发简单的应用程序以扫描条形码。 I have device: CP9700 and this document: 9700 .NET Programming There is a simple application which implememt barcode scanner in Appendix II (pages 277 and 278). 我有设备:CP9700和本文档: 9700 .NET编程附录II(第277和278页)中有一个简单的应用程序用于实现条形码扫描仪。

I have prepared project in VS2008 and copied program from appendix II. 我已经在VS2008中准备了项目,并从附录II复制了程序。 When I run it on my device I can't catch "WM_DECODEDATA" message. 在设备上运行它时,我听不到“ WM_DECODEDATA”消息。

Can anybody tell me what I'm doing wrong ? 有人可以告诉我我在做什么错吗?

First check the return value of RegisterWindowMessage (see https://msdn.microsoft.com/en-us/library/windows/desktop/ms644947%28v=vs.85%29.aspx for details), if it is 0 you need to use Marshal.GetLastWin32Error() (from System.Runtime.InteropServices) to get an error code. 首先检查RegisterWindowMessage的返回值(有关详细信息,请参见https://msdn.microsoft.com/zh-cn/library/windows/desktop/ms644947%28v=vs.85%29.aspx ),如果为0,则需要使用Marshal.GetLastWin32Error()(来自System.Runtime.InteropServices)来获取错误代码。 The error codes can be looked up in winerror.h of the installed WMx SDK. 可以在已安装的WMx SDK的winerror.h中查找错误代码。

The basic sampe app does not check return codes :-(( 基本的示例应用程序不检查返回码:-((

YOU should check the InitReader return code (see page 22 of the doc). 您应该检查InitReader返回码(请参阅文档的第22页)。

Please also check if the DLLs are being copied. 另请检查是否正在复制DLL。

   The following happens when decoded data comes about,
    A decode event broadcasts when the reader decodes data.
    The thread waits for the decode event, and the decode data can then 
    be obtained.
   For example,
    while(true) {
     dwStatus = WaitForSingleObject(handleEvent,INFINITE)
       b1 = Reader.ReaderEngineAPI.GetDecodeType();
       b1 = Reader.ReaderEngineAPI.GetDecodeData(ref tmp, tmp.length());
    }

Reader DLLs are accessible within the OS directory at the following paths. 可以在OS目录中的以下路径中访问读取器DLL。 Before developing your applications, copy the necessary files from the mobile computer via ActiveSync connection. 在开发应用程序之前,请通过ActiveSync连接从移动计算机复制必要的文件。 \\Windows\\Reader_Ce_Net.dll \\Windows\\ReaderDll_CE.dll \\ Windows \\ Reader_Ce_Net.dll \\ Windows \\ ReaderDll_CE.dll

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM