Initial API call fails

All topics about specific development with COM interface, LIP language, API in VB, ...

Moderators: remi77, Daniel, jacs

Posts: 2
Joined: Thu Aug 29, 2019 2:07 pm
TopSolid Module: TopSolid'Design
TopSolid Version: 6.18

Initial API call fails

Unread post by bellmik » Tue Sep 03, 2019 3:12 pm

Hi TopSolid,

First real post here.

I am using the API to programatically create a consistently formatted .top file that matches our sales order. Our engineers will then use this .top file to add their materials and draw from.

Not having a great start as the code is failing after on my initial API call.

My code is below. The initial popup I get after a few seconds is:

Standalone licenses

Cannot locate protection key.
Check the key connection and driver installation.

Software will run in demonstration mode.

I am using a shared license, and I can load and run TopSolid from my desktop without issues. Do I need a standalone license to use the API?

After a few more seconds I get the error message located at the bottom of this message.

Here is my code (written in C#, I can provide the VB.NET equivalent if need be.)

private TopSolid.Application TopApp;
TopApp = new TopSolid.Application();
ITopDocument topDocument = TopApp.Documents.Add("Test");
ITopDocument doc = topDocument;

It errors out on the line:

TopApp = new TopSolid.Application();

with the message

Message=Retrieving the COM class factory for component with CLSID {96DAB3E1-B2C2-4F2A-A175-91AA0275A714} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at WindowsFormsApp1.Form1.Button2_Click(Object sender, EventArgs e) in C:\Users\Michael.Bell\source\repos\WindowsFormsApp1\WindowsFormsApp1\Form1.cs:line 63
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at WindowsFormsApp1.Program.Main() in C:\Users\Michael.Bell\source\repos\WindowsFormsApp1\WindowsFormsApp1\Program.cs:line 19



Post Reply