【问题标题】:C++/WinRT - process exited with code -1073741819C++/WinRT - 进程退出,代码为 -1073741819
【发布时间】: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");
     
    }


  
}

【问题讨论】:

标签: c++ windows-runtime c++-winrt


猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-10-18
  • 2015-04-11
  • 1970-01-01
  • 2013-08-17
  • 2018-11-10
  • 2020-06-13
相关资源
最近更新 更多