通用Windows应用程序尝试将Windows控制台应用程序移植到UWA [英] universal windows apps an attempt to port a windows console app to UWA
问题描述
我在c ++控制台应用程序中编写的代码有问题。
代码在c ++&效果很好。 我想将应用程序移植到通用Windows应用程序。
$
我遇到的问题是我正在尝试使用
$
m_hCommPort = ::的CreateFile(L" \\\\.\\COM3" ;,
        GENERIC_READ | GENERIC_WRITE, //访问(读写)
0,   //             (股)0:不能共享COM端口     &NBSP ;                
 
 &NBSP ;      0,    //            安全 (无)                
       OPEN_EXISTING, //创建:open_existing
FILE_FLAG_OVERLAPPED,             //我们想要重叠操作
0                                        
//没有COM端口的模板文件...
);;
if(m_hCommPort == INVALID_HANDLE_VALUE)
{
ASSERT(0);           //我总是在这里结束了...
返回;
} b
$ b b用于访问com3上的设备:
设备它是虚拟的,它是一个位于usb末端的设备。
驱动程序是Silicon Labs Dual CP210x USB转UART桥接器。
我已经下载了最新的驱动程序。 我也和Silicon Labs谈过了。 实验室不支持通用Windows应用程序。
i已经建议更改package.appxmanifest以包含
<功能>
< Capability Name =" internetClient" />
$
< DeviceCapability Name =" serialcommunication">
< Device Id =" any">
< Function Type =" name:serialPort" />
$
< / Device>
< / DeviceCapability>
< / Capabilities>
和是UWA确实编译 - 它运行 但是不起作用 - 特别是m_hCommPort永远不会被初始化并且总是被困住。
$ b我的查询是:任何人都可以提供一些有关如何在Windows 10 VS 2015下正确调用通信设备以获得通用Windows应用的智慧之词吗?
谢谢你
布鲁斯
I have a problem with some code that I have written in c++ console app.
The code is in c++ & works well. I want to port the app to a universal windows appliction.
The problem I have is that I am trying to use
m_hCommPort = ::CreateFile(L"\\\\.\\COM3",
GENERIC_READ | GENERIC_WRITE, //access ( read and write)
0, // (share) 0:cannot share the COM port
0, // security (None)
OPEN_EXISTING, // creation : open_existing
FILE_FLAG_OVERLAPPED, // we want overlapped operation
0
// no templates file for COM port...
);
if (m_hCommPort == INVALID_HANDLE_VALUE)
{
ASSERT(0); // I always ended up here
return;
}
to access a device on com3:
The device is virtual in the sence that it is a device sitting at the end of a usb.
The driver is a Silicon Labs Dual CP210x USB to UART bridge.
I have downloaded the latest driver. I have also spoken to Silicon Labs. The Lab does not support universal windows application.
i have found a recommendation to change package.appxmanifest to include
<Capabilities>
<Capability Name="internetClient" />
<DeviceCapability Name="serialcommunication">
<Device Id="any">
<Function Type="name:serialPort" />
</Device>
</DeviceCapability>
</Capabilities>
and yes the UWA does compile - it runs but does not work - specifically m_hCommPort is never initialised and is always trapped.
My query is: can anybody provide some words of wisdom on how to correctly call a communications device under windows 10 VS 2015 for a universal windows appliction?
thanks
Bruce
推荐答案
嗨stargorg,
Hi stargorg,
感谢您在此发布。
根据您的情况,我会将其移至UWP论坛以获得更好的支持。
According to your case, I will move it to UWP forum for better support.
您的理解与合作将不胜感激。
Your understanding and cooperation will be grateful.
最诚挚的问候,
Sera Yu
Best Regards,
Sera Yu
这篇关于通用Windows应用程序尝试将Windows控制台应用程序移植到UWA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!