locked
WinRT component with IDL

    Question

  • I add a IDL file to expose the runtime class. Like this:

    import "Windows.Media.idl";
    
    #include <sdkddkver.h>
    
    namespace Mpeg2Decoder
    {
    	[version(NTDDI_WIN8)]
        runtimeclass Mpeg2Decoder
        {
    		[default] interface Windows.Media.IMediaExtension;
        }
    }

    When i compile it, report:

    1>  MIDLRT Processing .\Mpeg2Decoder.idl
    1>  Mpeg2Decoder.idl
    1>  MIDLRT Processing C:\Program Files\Windows Kits\8.0\Include\winrt\Windows.Media.idl
    1>  Windows.Media.idl
    1>  MIDLRT Processing C:\Program Files\Windows Kits\8.0\Include\winrt\inspectable.idl
    1>  inspectable.idl
    1>  MIDLRT Processing C:\Program Files\Windows Kits\8.0\Include\shared\wtypes.idl
    1>  wtypes.idl
    1>  MIDLRT Processing C:\Program Files\Windows Kits\8.0\Include\shared\wtypesbase.idl
    1>  wtypesbase.idl
    1>  MIDLRT Processing C:\Program Files\Windows Kits\8.0\Include\shared\basetsd.h
    1>  basetsd.h
    1>  MIDLRT Processing C:\Program Files\Windows Kits\8.0\Include\shared\guiddef.h
    1>  guiddef.h
    1>  MIDLRT Processing C:\Program Files\Windows Kits\8.0\Include\um\unknwn.idl
    1>  unknwn.idl
    1>  MIDLRT Processing C:\Program Files\Windows Kits\8.0\Include\winrt\hstring.idl
    1>  hstring.idl
    1>  MIDLRT Processing C:\Program Files\Windows Kits\8.0\Include\winrt\AsyncInfo.idl
    1>  AsyncInfo.idl
    1>  MIDLRT Processing C:\Program Files\Windows Kits\8.0\Include\winrt\EventToken.idl
    1>  EventToken.idl
    1>  MIDLRT Processing C:\Program Files\Windows Kits\8.0\Include\winrt\Windows.Foundation.idl
    1>  Windows.Foundation.idl
    1>  MIDLRT Processing C:\Program Files\Windows Kits\8.0\Include\winrt\IVectorChangedEventArgs.idl
    1>  IVectorChangedEventArgs.idl
    1>  MIDLRT Processing C:\Program Files\Windows Kits\8.0\Include\um\oaidl.idl
    1>  oaidl.idl
    1>  MIDLRT Processing C:\Program Files\Windows Kits\8.0\Include\um\objidl.idl
    1>  objidl.idl
    1>midlrt : error MIDL4034: Failed to load a dependency file. Windows.winmd (HRESULT:0x80070002 - Can't find the specify file )
    I don't know what's the dependency file


    haha

    Friday, April 06, 2012 8:45 AM

Answers

  • I compare the project files, and find the problem: It lack of MIDL setting. But i create the project by the wizard, i can't find how to add a MIDL for WinRT component. So i just copy it from a  sample project file to solve it.

    haha

    • Marked as answer by wuyueduzun Monday, April 23, 2012 9:12 AM
    Monday, April 09, 2012 8:56 AM

All replies

  • Hello,

    Would you please provide us more information about this issue? Like what function do you want to achieve. Maybe we can another alternative way to do this in metro.

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Monday, April 09, 2012 8:15 AM
  • I compare the project files, and find the problem: It lack of MIDL setting. But i create the project by the wizard, i can't find how to add a MIDL for WinRT component. So i just copy it from a  sample project file to solve it.

    haha

    • Marked as answer by wuyueduzun Monday, April 23, 2012 9:12 AM
    Monday, April 09, 2012 8:56 AM
  • Go To Property Pages->MIDL->General.

    Locate "Additional Metadata Directories", and add "$(WindowsSDK_MetadataPath)".

    Hit compile.


    This is my signature.

    • Marked as answer by wuyueduzun Monday, April 23, 2012 9:11 AM
    • Unmarked as answer by wuyueduzun Monday, April 23, 2012 9:12 AM
    Tuesday, April 17, 2012 7:56 PM