Hey all. First I would like to thank TTom aka Ernie for his templates. They are just great. Although I failed to late bind the object. It worked just find in VB, but I could not use CreateObject(). Is there a work-around this? Also, where do I get information on COM? Where did you get all your info Ernie? This message was edited by comrade, on 3/12/2001 7:49:00 PM
Posted on 2001-03-12 18:40:00 by comrade
VB doesn't like CreateObject? Well, I'm not sure what VB is doing behind the scenes to get that to work, probably some registry thing to translate the ClassName to the GUID. I never bothered looking for this, because Dim A as New {Some Com Object Type) Set A = New {Some Com Object Type) always worked for me. I've seen how somewhere, can't remember offhand (a quick search found nothing). I get my info from lots of sources, firstly "Inside COM" by Rogerson. There is no 2nd choice. Distant third choices are "Essential COM" by Box and "Inside OLE" which is available online in MSDN (or in your CD version).
Posted on 2001-03-12 23:44:00 by Ernie
I knew this was gonna bug me till I found out what it was... OK, CreateObject uses the Program ID name of the class. These are kept in the registry at:

So, if we take the MyCom2 tut for example, the program ID is defined (in mycom2.rgs) as:

ProgID = s 'MyCom.MyCom2.1'
That's the NAME assosciated with the class. It skips the GUID step, so it's not as sure. But lots easier on humans. Then, once I figured this out, I changed the line in the VB MyComTester app from:

   Set MC2 = New MyCom2        
To this:

   Set MC2 = CreateObject("MyCom.MyCom2.1")    
And it all worked just fine, thank you :-) (Keep in mind that the CLSID GUID may be found directly by opening that key, but ProgID requires a search (see the CLSIDFromProgID API).) This message was edited by Ernie, on 3/13/2001 3:21:10 AM
Posted on 2001-03-13 02:19:00 by Ernie
Ernie, in VB, when you call CreateObject, it looks for an IDispatch interface. If not supplied, likely it won't work. Here's some info on MSDN that might help... http://msdn.microsoft.com/library/psdk/automat/appc_1c6r.htm _Shawn This message was edited by Shawn Bullock, on 3/13/2001 10:55:18 AM
Posted on 2001-03-13 09:54:00 by _Shawn
Yep. Late binding means VB uses the dispatch interface. I know this, that's why CoLib supports IDispatch.
Posted on 2001-03-13 11:46:00 by Ernie
Hey again. Thanks TTom. Turns out I was using your first example as my base and that's why it don't work. Got the latest one and it looks really nice and easy :). Awesome work. Keep it up Ernie!
Posted on 2001-03-13 17:42:00 by comrade