Really really thanks for your comments ...
But I found that the COM exception was not caused by the reference of type library actually.
After I've changed the code as below ,and tested it on both VX1.1 and VX2.1 ,It runs nomarly.
If you have serval versions installed at the same time ,
You should get the Type like:GetTypeFromProgID("MGCPCBAutomationLicensing.Application" + "ProgIDVersion "),
Mentor gives the reference under folder : $SDD_HOME\standard\examples\pcb\Automation\ReleaseEnvServerExamples\
That works, as long as you know the install path. If you don't, or someone puts it in a different location, your hard-coded path won't work. There are other methods.
This is a good thread with lots of information about this subject. You can use the Release Environment Server, or get the values for COM version (prog_id) and mglaunch from the registry. I prefer the registry, as I find it simpler and more direct than using the RES.
Read carefully. Take note that you need to use mglaunch in any application where you use the CreateObject statement, as opposed to GetObject when either starting a new instance of a Mentor application or, conversely, attaching to an existing session. CreateObject starts a new application session from scratch, GetObject attaches to an already-open session. mglaunch is needed for CreateObject.
Hi Patrick, can you please make the templates available again? The links you provided no longer work. I am mostly interested in the vb.net template.