在VBA中引用Windows便携式设备文件时遇到问题? [英] trouble referencing Windows Portable Device files in VBA?

查看:83
本文介绍了在VBA中引用Windows便携式设备文件时遇到问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在不懈地寻找解决问题的方法,但是没有发现任何有用的东西!!因此,我希望在座的人能帮助我解决具体问题……预先感谢!

I have been tirelessly searching for a solution to my problem but have not found anything helpful!! So I hope someone on here can help my specific situation... Thanks in advance!

因此,我有一个条形码扫描仪,可将清单中的库存作为文本文件存储在其内部存储器中.通过使用Windows Mobile设备中心6.1,我可以在PC上浏览扫描仪文件夹并打开该文本文件以查看我扫描了哪些项目.

So, I have a barcode scanner that stores inventory in its internal memory as a text file. Through the use of Windows Mobile Device Center 6.1 I am able to, on my PC, navigate through the scanners folders and open up that text file to see what items I scanned.

我正在编写一个excel宏,它将打开该文本文件,读取清单的每一行,然后对它进行其他操作.到目前为止,如果我将扫描仪上的文本文件复制到我的文档"之类的地方,那么我已经成功了.但是,我想使它变得简单,并能够直接从扫描仪中打开该文本文件.

I am writing an excel macro that will open up that text file, read each line of inventory, and then do other things with it. I have been successful thus far if I copy that text file on the scanner into some places like 'My Documents'. However, I want to make it easy and be able to open up that text file directly from the scanner.

我的问题是引用扫描仪的路径.因为它是便携式设备,所以它没有C:之类的驱动器.路径看起来像是"Computer \ MT2070-ML416147 \ Application \ Inventory \ export.txt".但是,当我尝试打开该路径进行输入时,出现错误消息找不到路径".

My problem is with referencing the path to the scanner. Because it is a portable device, it does not have a drive like C: or something. Instead the path looks like 'Computer\MT2070-ML416147\Application\Inventory\export.txt'. However when I try to open that path for input I get an error saying "Path not found".

如果有人可以提供帮助,我将非常感激!!如果有人需要我拥有的代码片段,请告诉我.

If anyone can assist I would be very appreciative!! If anyone requires code snippets of what I have, please let me know.

推荐答案

无法通过Windows文件系统API访问附加的Windows CE设备文件系统的内容,这是因为它们不是已装载的卷.您的设备出现在Windows资源管理器中,因为WMDC安装了一个Shell命名空间处理程序,该处理程序创建了代表所连接设备的Shell文件夹-这与控制面板"和网上邻居"文件夹的工作方式相同,即使它们也不是真正的文件系统目录.可以将其视为Windows在文件系统抽象上的挥舞之手.

There is no way to access the contents of attached Windows CE device's filesystem through the Windows filesystem API, this is because they are not mounted volumes. Your device appears in Windows Explorer because WMDC installs a Shell Namespace handler that creates shell folders that represent the attached device - this is the same way that the Control Panel and Network Places folders work, even though they too are not true filesystem directories. Think of it as Windows hand-waving over the filesystem abstraction.

一切都不会丢失,但是,您有一些选择:

All is not lost, however, you have a few options:

  1. 使用智能设备连接API浏览设备并从中获取数据文件:
  1. Use the Smart Device Connectivity API to explore the device and get data files out of it: https://msdn.microsoft.com/en-us/library/bb384093.aspx - this is the same API that Explorer is using when it shows you shell folders of the device.
  2. Remove the storage volume (e.g. an SD card) from the device and plug it in to an SD card reader on your computer so you can browse and manipulate the filesystem directly.
  3. Write a program that runs on the device itself to push data from the device to a shared location.

选项1将为您带来最佳效果,但可能需要在C ++/Win32中对其进行编码. VBA并不是进行系统编程的最佳环境.您始终可以用C ++编写并将层显示为COM对象,然后可以通过VBA进行使用.尽管您会遇到32/64位Office的问题,也可能会遇到沙盒问题.

Option 1 will get you the best results but will likely require coding against it in C++/Win32. VBA is not the best environment to do systems programming in. You can always write in C++ and expose your layer as a COM object which you can then consume through VBA. Though you'll run into problems with 32/64-bitness of Office, and probably sandboxing issues too.

选项3会有些困难,因为针对Visual Studio 2008发行了用于Windows CE的"Windows Mobile"风格的最后一个SDK-不支持VS的最新版本.这意味着针对WinCE API使用贫瘠的Compact Framework 3.5或C ++ 03.巧合的是,我认为这是Windows Mobile在iPhone推出时注定要失败的部分原因:环境太被忽视了,其背后无法跟上.

Option 3 will be slightly difficult as the last SDK for the "Windows Mobile" flavour of Windows CE was released for Visual Studio 2008 - there is no support for more recent versions of VS. That means using either the anemic Compact Framework 3.5 or C++03 against the WinCE API. Coincidentally, I believe this is part of the reason Windows Mobile was doomed when the iPhone came out: the environment was just too neglected and behind it couldn't keep up.

这篇关于在VBA中引用Windows便携式设备文件时遇到问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆