Quantcast
Channel: MicroStation Programming - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 1677

Re: [v8i - VB.net] New Applicationclass - Second instance?

$
0
0

Thank you Jon and Jan.

Unfortunately it doesn't seem you can create an Bentley.Interop.MicroStationDGN.Application (or Bentley.Interop.MicroStationDGN.ApplicationClass ...) using CreateObject

       Try

           mApp = CreateObject("Bentley.Interop.MicroStationDGN.Application")

       Catch e As Exception

           MessageBox.Show(e.Message)

       End Try

Gives you Cannot create activeX component

However, after digging some more I found

When a program running outside of MicroStation calls CreateObject("MicroStationDGN.Application"), the call attaches to a running instance of MicroStation if there is one. Otherwise, it starts a new instance of MicroStation. Subsequent calls to CreateObject("MicroStationDGN.Application") attach to the same instance of MicroStation.

CreateObject("MicroStationDGN.ApplicationObjectConnector") always starts a new instance of MicroStation. A program can use GetObject(, "MicroStationDGN.ApplicationObjectConnector") to attach to an instance of MicroStation that is already running or to test to see if MicroStation is already active.


So the New Application gives me an existing object and New ApplicationObjectConnector gives me a new one... A+ for clarity on that one.

The solution I used:

Dim mApp As Mstn.Application
Dim mConn As Mstn.ApplicationObjectConnector = New Mstn.ApplicationObjectConnectorClass
mApp = mConn.Application

Regards,
Rv




Viewing all articles
Browse latest Browse all 1677

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>