【发布时间】:2022-06-10 20:27:36
【问题描述】:
我正在使用 C++/winRT 来使用 Microsoft 的 HumanInterfaceDevices API。尝试运行调用 GetDeviceSelector API 时,我得到这个进程退出并出现代码 -1073741819 错误。这是程序由于某种原因终止的地方。
我对c++没有太多经验,有人可以帮忙吗?
#include "pch.h"
#include <iostream>
#include <string>
using namespace winrt;
using namespace Windows::Foundation;
using namespace winrt::Windows::Devices::HumanInterfaceDevice;
int main()
{
//uint16_t const pid[] = { 0xBA0, 0x5C4, 0x09CC }
init_apartment();
int const product = 0x09CC;
int const vid = 0x054C;
int const usagePage = 0x01;
int const usageId = 0x02;
IHidDeviceStatics hello;
try {
printf("trying");
winrt::hstring data = hello.GetDeviceSelector(usagePage, usageId, vid, product);
}
catch (...) {
printf("error\n");
}
}
【问题讨论】:
-
-1073741819是访问冲突:https://james.darpinian.com/decoder/?q=-1073741819
标签: c++ windows-runtime c++-winrt