PInvoke in Metro Apps with Windows 8 / WinRT

前端 未结 2 1250
伪装坚强ぢ
伪装坚强ぢ 2020-12-18 00:00

I have an simple FM Radio Tuner App in Silverlight 5 Out-of-browser that calls code from a Native C++ DLL from my USB FM Receiver using PInvoke. This application works very

相关标签:
2条回答
  • 2020-12-18 00:41

    As per Pavel Minaev's reply to Chris Pietschmann's answer:

    P/Invoke and COM Interop are most certainly supported for .NET Metro apps. Win32 API is also supported, and can be called through the above technologies, though it is limited to those functions that are available to Metro apps (i.e. if a C++ Metro app can't call it, neither can a .NET app).

    As Morten Frederiksen points out, it is however likely that CarTFTFM.dll contains an unsupported part of the Win32 API surface for WinRT:

    Only a subset of Win32 and COM API is supported: msdn.microsoft.com/en-us/library/windows/apps/br205757

    0 讨论(0)
  • 2020-12-18 01:02

    Unless it is a system DLL or otherwise locatable through the system path, you need to make sure that your DLL is copied to the same folder as your Metro application is deployed in.

    I solved the problem by adding the native DLL to my Metro application project, ensuring that Build Action is set to Content and that Copy to Output Directory is set to Copy Always or Copy if Newer.

    0 讨论(0)
提交回复
热议问题