DCSIMG
COM - Pavel's Blog
Sign in | Join | Help

Pavel's Blog

Pavel is a software guy that is interested in almost everything
software related... way too much for too little time

Browse by Tags

More Media Info with Media Foundation
28 March 11 07:07 PM | pavely | with no comments
Getting information on media files is possible through Media Foundation, as we’ve seen , using the various “descriptors”. If we look at Windows Explorer, we can see other information presented, such as artist, title and other metadata. This information is also accessible through media foundation, without resorting to the (mostly) dreadful shell API. To get to these properties, we can query the media source for the IMFGetService , which is conceptually similar to IServiceProvider used in various APIs...
Getting Media File Info
20 March 11 11:55 AM | pavely | 3 comment(s)
So, what can we do with Media Foundation? One of the simplest things, perhaps, is getting information on some media file, somewhat similar to what we see in Windows Explorer, but we can dig deeper if we like. Let’s get started. First, we’ll create a simple Win32 console application named MediaInfo (I check the box to include ATL headers, we’ll use ATL smart pointers). We then add some Media Foundation includes (e.g. in StdAfx.h): #include <mfidl.h> #include <mfapi.h>   These are...
Introduction to Windows Media Foundation
07 March 11 11:26 PM | pavely | 3 comment(s)
I’ve been writing a new course on this technology, so I thought I’d share some of my experiences with the Windows Media Foundation. What is Windows Media Foundation? The Windows Media Foundation is technically the successor of DirectShow (which is still around and very much supported), introduced in Windows Vista and enhanced in Windows 7. It’s a multimedia platform, capable of playing, analyzing, writing and otherwise transforming media (mostly video & audio, but can technically be anything...
COM Fun with Microsoft Agent
25 February 11 03:44 PM | pavely | 1 comment(s)
Whenever I teach COM interoperability in .NET, I try to show some nice demo for this. The classic is to use one of the Office applications (such as Word) to do some automation by creating a document, adding some text, etc. This is effective enough but not really fun. A much more fun way is to use the Microsoft Agent technology. MS Agent is discontinued as far as further development is concerned, but it’s still fun and great for (at least) learning purposes. What is MS Agent? Its most well known appearance...
Windows Platform Developers User Group meeting
06 October 10 10:45 PM | pavely | 3 comment(s)
This evening was a WPDUG meeting on CLR hosting and CLR profiling. Thank you all for coming! It was a pleasure to see so many of you there. My session was on CLR hosting, using the new CLR 4 hosting API. This is done using native code (C++) that uses COM for communication between the CLR and the host, both ways. I showed how to enumerate the installed runtimes, how to load a specific CLR (a new feature of CLR 4 – the ability to host multiple CLRs in a single process), how to create an application...
How To Be a Cool C++ Programmer / Developer
13 September 10 10:28 PM | pavely | 1 comment(s)
A few weeks ago I blogged about how to be a cool C# programmer. if you are a C++ programmer, you can be cool, too. The next C++ standard, dubbed C++0x promises many enhancements and cool abilities, but in this post I’ll stick with the current C++ standard. Here are some ways of being a cool C++ programmer (in no particular order): 1. Zeroing out a structure and setting its first field in one swoop One of the common needs in a native Windows applications is setting up structures in preparation for...
תגים:, , ,
ROT Object Invisible When Hosted in a Service
11 November 08 11:23 AM | pavely | with no comments
This will not interest any .NET developers… One of my customers wanted to create a system-wide singleton COM object hosted in a Windows service. However, the object implementation must be in a DLL. The service should start and create an instance of the object and make it available from other client processes. A simple approach would be to use the RegisterActiveObject function to register that instance as the class moniker of its kind. A client can get a proxy to the same instance by using GetActiveObject...
Writing a .NET Profiler
20 May 08 09:36 AM | pavely | 2 comment(s)
I was recently asked how a managed application can know the actual size of managed objects it allocates. Although there exists a Marshal.SizeOf method that seemingly can do the trick, this only works for value types, as the method is intended to be used in interop scenarios where some unmanaged memory must be allocated in managed code and passed to some unmanaged function. This question, and others like it can best be answered by using a the .NET profiling API. The .NET profiling API allows the ...
.NET, COM and Apartments Tips
21 February 08 06:18 PM | pavely | 1 comment(s)
We all know that when we use COM interop with .NET we get some RCW (Runtime Callable Wrapper) CLR object representing and controlling access to the underlying COM object. When we call the C# new operator, under the hood the RCW calls the CoCreateInstance API to create the actual COM object, etc. What may not be apparent, is that there may exist another proxy to the COM object, even if the COM server is a DLL (in-process server). The reason this may happen is related to COM apartments. an Apartment...
COM without registration
06 January 08 09:36 AM | pavely | 20 comment(s)
Those still using COM know that COM components must be registered in the Windows Registry to be workable. Sometimes this may not be acceptable. Sometimes you might want to run an application that may be using many COM DLLs, but don't want or can't (because of some policies) to register the components. Sometimes you want to run an application on some client's machine without any setup. Can this be done? Off the bat, that seems impossible. But there is actually a way. What I've done...