Re: Riddle Me This



"pbd22" <dushkin@xxxxxxxxx> wrote in message news:64dc2ce2-6d04-4cc7-8cc7-7e744ce9a16a@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Thanks again Willy.

I sent you the windows service code to your private email address.
You will see the calling method there (I sent a description in my
email).

Feel free to continue the thread by responding here.

THanks again for all your help!
Peter



Ok, I noticed in another reply that the only thing that gets done by the COM components, is retrieving the metadata from Windows media files (video) and dumping this data to a text file. If this is what you are doing, then there is no reason to use VB6 and COM stuff any longer.
All you should do is declare the IWMHeaderInfo3 and the IWMMetadataEditor COM interfaces (search wmsdkidl.idl in the platform sdk headers) and declare the WMCreateEditor function exported by the WMVCore.dll.

Here the PInvoke declaration and part of the COM interface definitions to get you started.

[DllImport("WMVCore.dll",SetLastError=true,
CharSet=CharSet.Unicode, SuppressUnmanagedCodeSecurity)]
public static extern uint WMCreateEditor(
[Out, MarshalAs(UnmanagedType.Interface)] out IWMMetadataEditor ppMetadataEditor );

// COM interfaces IWMMetadataEditor and IWMHeaderInfo3 (check wmsdkidl.idl in the Platform or the Media SDK headers).
[Guid("96406BD9-2B2B-11d3-B36B-00C04F6108FF"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWMMetadataEditor
{
uint Open( [In,MarshalAs(UnmanagedType.LPWStr)] string pwszFilename );
uint Close();
uint Flush();
}


[Guid("15CC68E3-27CC-4ecd-B222-3F5D02D80BD5"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWMHeaderInfo3
{
uint GetAttributeCount(
[In] ushort wStreamNum,
[Out] out ushort pcAttributes );

// other IWMHeaderInfo3 methods
.....



Basically what you should do is call the WMCreateEditor API to get a pointer to the IWMMetadataEditor interface.
Once you have this interface, you can call it's Open method to open a media file.
When you cast the IWMMetadataEditor to an IWMHeaderInfo3 interface, you can get the metadata. Methods to call are GetAttributeCountEx and GetAttributeByIndexEx.
When done with the file, you call IWMMetadataEditor Close and quit.
The media API's and COM interfaces can be used from MTA threads, so there is nothing to worry about when used from Service threads.

Willy.

Willy.





.



Relevant Pages

  • Re: Error signature when calling GetScriptCount of IWMHeaderInfo3
    ... public static extern uint WMCreateEditor( ... public interface IWMMetadataEditor ... public interface IWMHeaderInfo3 ... This is definitely your problem--when declaring COM interfaces ...
    (microsoft.public.windowsmedia.sdk)
  • Re: Error signature when calling GetScriptCount of IWMHeaderInfo3
    ... public static extern uint WMCreateEditor( ... public interface IWMMetadataEditor ... public interface IWMHeaderInfo3 ... This is definitely your problem--when declaring COM interfaces ...
    (microsoft.public.windowsmedia.sdk)
  • Re: Wireless Zero Config
    ... Yes the interface is on. ... uint uiInFlags = 0xFFFFFFFF; ... uiRet = WZCEnumInterfaces; ... uiRet = WZCQueryInterface(null, uiInFlags, ref Intf, ref ...
    (microsoft.public.win32.programmer.networks)
  • Re: ClassInterfaceType.AutoDual vs. ClassInterfaceType.AutoDispatch
    ... recommend that you have the method/property return an int, and not a uint. ... interface, rather, implementing the COM interface that is defined ... > Looking at the tlb, I see that many of the methods that cannot be called> either take or return a uint, which is transformed in the tlb as an> "unsigned long." ... I'm guessing that the VBA compiler is choking on that> type. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: ClassInterfaceType.AutoDual vs. ClassInterfaceType.AutoDispatch
    ... so that it returns an int, not a UINT. ... Nicholas Paldino [.NET/C# MVP] ... The reason we're not doing as you> suggested is that B, which implements A, also has some other methods> which are not in the interface A and hence casting it to A would cripple ... The tlbexp is chocking on it for some reason. ...
    (microsoft.public.dotnet.languages.csharp)