I try to create wrapper for WMSyncReader. The code is :using System;
using System.Runtime.InteropServices;
namespace WMFSDKWrapper
{
public class WMFSDKFunctions
{
[DllImport("WMVCore.dll", EntryPoint="WMCreateSyncReader",
SetLastError=true,
CharSet=CharSet.Unicode, ExactSpelling=true,
CallingConvention=CallingConvention.StdCall)]
public static extern uint WMCreateSyncReader(
[In,MarshalAs(UnmanagedType.IUnknown)] System.Object
pUnkReserved,
[In] short dwRights,
[Out,MarshalAs(UnmanagedType.Interface)] out IWMSyncReader
ppReader);
public WMFSDKFunctions()
{
//
// TODO: Add constructor logic here
//
}
}
[Guid("9397F121-7705-4DC9-B049-98B698188414"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown )]
public interface IWMSyncReader
{
uint Open(
[In,MarshalAs(UnmanagedType.LPWStr)] string pwszFilename);
}
}
When i call the class using this code :
string pwszInFile = @"c:\test.wma";
IWMSyncReader ppSyncReader
WMFSDKFunctions.WMCreateSyncReader(null, 0, out ppSyncReader );
ppSyncReader.Open( pwszInFile ) ;
I got the message : "Catastrophic Failure"
Can anyone advise me of the best approach to doing this through .NET?
Many thanks...