Imports System.Runtime.InteropServices
Module Program
<STAThread()> _
Sub Main()
Dim objApplication As SolidEdgeFramework.Application = Nothing
Try
'Old VB6 Syntax
'objApp = GetObject(, "SolidEdge.Application")
OleMessageFilter.Register()
' Connect to a running instance of Solid Edge
objApplication = Marshal.GetActiveObject("SolidEdge.Application")
Catch ex As Exception
Console.WriteLine(ex.Message)
Finally
OleMessageFilter.Revoke()
End Try
End Sub
End Module
using Examples;
using System;
using System.Runtime.InteropServices;
namespace SolidEdge.SDK
{
class Program
{
[STAThread]
static void Main(string[] args)
{
SolidEdgeFramework.Application application = null;
try
{
OleMessageFilter.Register();
// Connect to a running instance of Solid Edge
application = (SolidEdgeFramework.Application)
Marshal.GetActiveObject("SolidEdge.Application");
}
catch (System.Exception ex)
{
Console.WriteLine(ex.Message);
}
finally
{
OleMessageFilter.Revoke();
}
}
}
}