Smalltalk Daily 10/11/10: A Simple COM Example in VW
Today's Smalltalk Daily looks at interfacing to a simple COM api in Windows - specifically, the speech API. The code to get the dispatch driver is a little involved, so the #setupDriver method in the video is included below - to skip to the video, click here. If you can't see the embedded video directly, you can go directly to YouTube for it.
setupDriver "set up the COM driver" | ref descs ifc guid refs | refs := COMRegistryInterface extTypeLibraryIDMap select: [:each | each name notNil]. ref := refs detect: [:each | 'Microsoft Speech Object Library*' match: each name] ifNone: [nil]. ref ifNil: [^nil]. descs := ref containedTypeDescriptions. ifc := descs detect: [:each | 'SpVoice' match: each name] ifNone: [nil]. ifc ifNil: [^nil]. guid := ifc guid. driver := AdvancedDispatchDriver on: (IClassFactory createInstance: guid iid: External.COMConstants.IID_IDispatch context: External.COMConstants.CLSCTX_SERVER). ^driver
To watch now, click on the viewer below:
You can follow the Smalltalk channel on YouTube for all the "Smalltalk Daily" videos. You can also check out the videos on Vimeo, where the quality is higher, or over on Facebook, if you are a member.
You can download the video directly here. If you need the video in a Windows Media format, then download that here. If you like this kind of video, why not subscribe to "Smalltalk Daily"?