1

I'm using Qt 5.6 Alpha WinRT port on Windows 10 and want to access WinRT's Wifi Direct API from Qt app.

I know that WRL should be used for that. But I get different behavior using Wifi Direct API in my app and trying Windows Universal example from Microsoft's GitHub repository. More specifically I get E_NOTIMPL when trying to activate WiFiDirectDevice, while Microsoft's sample works just fine.

HStringReference strDevice(RuntimeClass_Windows_Devices_WiFiDirect_WiFiDirectDevice);

ComPtr<IInspectable> insp;
hr = RoActivateInstance(strDevice.Get(), insp.GetAddressOf());

So I'm confused about what type of API I'm calling (windows store or desktop) from Qt app?

demonplus
  • 5,613
  • 12
  • 49
  • 68
Yrchgrchh
  • 169
  • 8
  • 1
    The error is very accurate, this really isn't implemented. You must create the instance with the factory function, FromIdAsync(). Well demonstrated in the sample code. You'll probably fall in the pit of success a lot quicker when you write a bit of C++/CX code instead. – Hans Passant Sep 11 '15 at 12:08
  • @HansPassant Qt strongly recommends to use WRL. And I didn't find any info on how to use C++/CX and API without ABI namespace in Qt app. Is it possible to achieve this with WRL? – Yrchgrchh Sep 11 '15 at 12:30
  • @HansPassant I mean in order to call FromIdAsync I need to activate IWifiDirectDeviceStatic interaface, which returns me E_NOTIMPL as well. And there are no factories in my windows.devices.wifidirect.h – Yrchgrchh Sep 11 '15 at 12:34
  • @HansPassant Thanks, switching to C++/CX did the trick – Yrchgrchh Sep 14 '15 at 13:11

1 Answers1

0

I'll try to answer myself, though I'm not 100% sure.

Qt's documentation says that "Qt for WinRT allows you to run Qt applications on devices supporting the Windows Store App APIs." and "WinRT applications run in a sandboxed environment..."

Based on this and the fact that separate Qt port for WinRT that does the same job as Windows Desktop Qt doesn't make sense, I can make an assumption that Qt port create Windows Store app and use Windows Store API.

But I will really appreciate if someone confirm this.

Yrchgrchh
  • 169
  • 8
  • Your assumtion is correct. But most code from Qt Desktop works without modification on Qt WinRT. – Hyndrix Feb 04 '16 at 10:33