locked
WinRT pointers to a Windows DLL

    Question

  • I'm  trying to write a simple interface, its implementation in WinRT and create a pointer for the same. Now, I've another Win32 DLL which i would load in my app through loadpackagedlibrary. Is there a way to send across the interface pointer to a windows 32 DLL and access the methods i've referenced in the RT interface through the pointer ?


    • Edited by Minu7 Saturday, February 22, 2014 6:31 PM
    Saturday, February 22, 2014 6:30 PM

Answers

  • There are very few samples of using WinRT from Win32 DLLs generally, as it's generally not recommended (i.e. you are generally expected to use C++/CX to consume WinRT from C++ code as it's far more productive and in a number of cases more effiicent). DirectXTK has some code in the Audio\AudioEngine.cpp module that uses WRL to call a WinRT API from a Win32 desktop app for enumerating devices that you could look at, but it is pretty specific to that use-case.

    Otherwise there's MSDN docs on WRL and a BUILD talk.


    Wednesday, February 26, 2014 6:33 PM

All replies

  • From the Win32 DLL you'd have to be consuming WinRT which is possible although not well documented. You can use WRL rather than C++/CX.
    Sunday, February 23, 2014 6:54 AM
  • Thanks Chuck..It would be helpful if there is any sample that you can direct me to.Also, any other possible ways, please let me know. How about writing a WinRT component and consuming it from the win32 DLL ?
    Sunday, February 23, 2014 4:22 PM
  • Can someone help with this ? Any samples or documents to refer to on to how to achieve this ?

    thanks !!

    Wednesday, February 26, 2014 1:24 PM
  • There are very few samples of using WinRT from Win32 DLLs generally, as it's generally not recommended (i.e. you are generally expected to use C++/CX to consume WinRT from C++ code as it's far more productive and in a number of cases more effiicent). DirectXTK has some code in the Audio\AudioEngine.cpp module that uses WRL to call a WinRT API from a Win32 desktop app for enumerating devices that you could look at, but it is pretty specific to that use-case.

    Otherwise there's MSDN docs on WRL and a BUILD talk.


    Wednesday, February 26, 2014 6:33 PM
  • thanks a lot..Please do let me know if there are any other ways to achieve this.

    Thanks !!

    Wednesday, February 26, 2014 6:46 PM
  • I see this error when i try to include a file that contains this definition in WinRT. 

    error C2039: 'CAtlStringA' : is not a member of 'ATL

    Any clues on what this may be due to ?

    Thanks !!

    Monday, March 3, 2014 7:25 PM
  • You should not attempt to use WRL and ATL in the same compilation module...

    Monday, March 3, 2014 8:10 PM