Date: | July 8, 2005 / year-entry #185 |
Tags: | other |
Orig Link: | https://blogs.msdn.microsoft.com/oldnewthing/20050708-22/?p=34983 |
Comments: | 14 |
Summary: | I was introduced to the glory that is the world of Mr. Bunny many years ago. Mr. Bunny's Guide to ActiveX is probably the best book on ActiveX programming ever written. If you haven't figured it out by now, it's a humor book, but it's the sort of madcap insane geek humor that has enough... |
I was introduced to the glory that is the world of Mr. Bunny many years ago. Mr. Bunny's Guide to ActiveX is probably the best book on ActiveX programming ever written. If you haven't figured it out by now, it's a humor book, but it's the sort of madcap insane geek humor that has enough truth in it to make you laugh more. My favorite is the first exercise from the first chapter: Connect the dots. (Warning: It's harder than it looks!) |
Comments (14)
Comments are closed. |
"In his new book Carlton Egremont III brings the complex topic of ActiveX to a new audience – a target group with the combined intelligence of a sack of creme caramels"
I thought VB programmers were the original target audience for ActiveX.
He also wrote a followup, Mr Bunny’s Big Cup of Java. I have both on my shelf here at work.
I tried to get it at Borders and they say it is out of print :(
Figure 4.1.1.1.1.1.1.1.1.1 on the website looked pretty good – I think I’ve seen something like that before but for real!
Hmm COM.
I have to say that while COM may be very well implemented for what it was designed to do, I’ve seen it misused so much that nowadays I just assume that any usage of COM will be just as bad.
Most of the misuse orients around using COM to do things that the language the application is written in can already do, thus resulting in an ugly great big interface between the application and the code in the COM object.
I can only think of two good reasons why one would want to use COM:
– If you want to allow future third party code into your program at some point using some well known working model. ie. the job that OLE was orignially designed for
– If you want to do object handling across a network (because hey, you will prolly have to use an external library of some kind to do this any way and DCOM is prolly as good as any other )
Rant over.
<br>Factory :
<br>" Most of the misuse orients around using COM to do things that the language the application is written in can already do, thus resulting in an ugly great big interface between the
<br>application and the code in the COM object. "
<br>
I beg to differ. From a c++ perspective, COM was the next best thing to sliced bread. It gave most c++ grunts a view of the bright and shiny world of design patterns, and reintroduced most to contract based programming.
I dont do COM any more. I’ve switched over to .Net for most dev work. But lately I’ve had to write some stuff in c++, lisp and python. And I needed to get all my stuff talking to each other. And guess what? I didnt do COM exactly, but something pretty much close to it. In fact you might say I’ve been "inspired" by it :)
And its nice that someone has brought out a fun book on COM, I think I’ll gift it to my Mom :))
Oh man that was hilarius. I haven’t read the book so I just went to Amazon to see a few pages. Here is the table of contents:
http://tinyurl.com/dnbzb
I never again use COM if there is an option, after I found out that even Microsoft themselves have released (production software) COM interfaces with the same ID’s but with changed interfaces (see the Kodak component, and compare between Win9x and NT4).
Once I realized MS themselves abused their own rules to such an extent (we were bitten by it, and *not* happy I might add), I got validation of my strong suspicion that COM was really nothing more than the VB "programmers" playground. Having seen the incredible slowdown of even OS-components due to COM usage, when a plain DLL and a C interface would have been a way better match, I have given up.
Another reason to dislike it, is that it’s the major source of installing NT4+ takes such an extrordinary amount of time (while often idling CPU for long periods!).
ActiveX was cool, when it was presented as the alternative to the VB controls (CBX, or something like that), but it really sucks donkey when you actually need to use it and realize how badly it really is designed and integrated into the rest of the Windows UI.
Personally, I think COM is awesome – its one of the few ways you can use native code in an ASP page, for example.
Most of its problems come from (some teams in) MS’s own abuse it in overcomplicated APIs (ActiveX,DirectShow).
Its hilarious to walk through the MS docs coming across something like "Although technically in violation of COM rules", lol.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directshow/htm/iasyncreaderrequest.asp
Not only that, but as an example, there are numerous interfaces to get an embedded ActiveX WMP. You’ve got IActiveMovie/2/3, IMediaPlayer/2 and the ALLNEW 10 SDK which has a ton of relatively useless interfaces. The 3rd activemovie only contains get_MediaPlayer, which you could have used QueryInterface for..
Making an ActiveX container is relatively (compared to an actual control) easy though, which is kind of nice I guess. Making an actual ActiveX control though is pretty much a waste of (a lot of) time…
WikiServer Guy: Actually I’m not 100% certain, but I suspect that the MediaPlayer property on the IActiveMovie3 is because the IActiveMovie3 object isn’t a IMediaPlayer. Instead, the IActiveMovie3 is associated with an IMediaPlayer, in which the MediaPlayer property is appropriate.
Hi Larry,
> WikiServer Guy: Actually I’m not 100%
> certain, but I suspect that the MediaPlayer
> property on the IActiveMovie3 is because the
> IActiveMovie3 object isn’t a IMediaPlayer.
> Instead, the IActiveMovie3 is associated
> with an IMediaPlayer, in which the
> MediaPlayer property is appropriate.
Except not only is QueryInterface easier, but the interface you get with get_ActiveMovie isn’t really a IActiveMovie – apparently (and this is a guess because I just stuck with QueryInterface) you can only make idispatch calls (I assume the nasty DISPATCH_PROPERTY stuff that gives COM its bad name) through the freakish thing – even querying the interface for an IActiveMovie returns E_NOINTERFACE! (And of course this means calling an IActiveMovie method on it crashes your application – I know the hard way! I googled for like an hour just to find out that you could just query the mediaplayer).
I’m sure its some kind of fundamental misunderstanding of COM on my part though, who knows, LOL :).
// Dump from your com browser –
// amcompat.idl (Microsoft Active Movie Control (Ver 2.0))
// msdxm.idl (Windows Media Player (Ver 1.0))
IMediaPlayer* pMP = NULL;
IActiveMovie* pAM = NULL;
::CoCreateInstance(CLSID_MediaPlayer, NULL,
CLSCTX_INPROC_SERVER,
IID_IMediaPlayer, (void**)&pMP);
#if IWANTBUGS
pMP->get_ActiveMovie((IDispatch**)&pAM);
#else
pMP->QueryInterface(IID_IActiveMovie, (void**)&pAM);
#endif
//Attach to your ActiveX container or whatever
//Call this with IWANTBUGS and you’ll crash
pAM->put_MovieWindowSize(amvDoubleOriginalSize);
I still haven’t found the poodle in chapter 4.
In case anyone else doesn’t want to pay the astronomical prices being asked by sellers of used copies on Amazon and some other sites, I’ll say where I found mine.
http://www.ecampus.com/bk_detail.asp?ISBN=0201485362
Now wondering how long it will take for them to sell out too.