Hi all,
I am trying to launch Microstation from an external program using Visual Basic.
How can i define the user and the workspace that i want to launch Microstation in ?
so far i have this:
Dim BMAPP As New MicroStationDGN.Application BMAPP.Visible = True Dim dgnfile As MicroStationDGN.DesignFile dgnfile = BMAPP.OpenDesignFile("location of file,.....")
Is there any way that i can specify these variables?
Thanks?
p.s. I would prefer not to use the L.A. Solutions Microstation Detector...
To start MicroStation programmatically there are two primary methods.
The second method is using Microsoft VBA's "Shell" function, Microsoft C# "Process.Start", or Win32 "CreateProcess"/"ShellExecute"; where you have full control of how you start processes and can provide a full path and file name of the executable, any necessary command line arguments and (initial) filename to open/start with. I presume the L.A.Solutions MicroStation Detector may be querying the Microsoft Installer registry entries and providing a list of installed products, using their physical discovered locations, and allowing command line arguments to be passed and started via Microsoft Shell function or similar lower level API calls to start the process in a very specific manner. These same steps would be required if you simply cannot create your program to use a known path to a product to start the application.
For cases that require opening MicroStation with a properly configured workspace and/or user the second option is the correct one to use. Microsoft COM does not allow us to provide command line arguments. Secondly due to the the low level items that MicroStation Workspaces affect and since we do not offer a public API that could allow for cleanly switching between workspaces on-the-fly, creating a process new passing command line arguments will provide the most predictable results.
HTH,Bob
Unknown said:I would prefer not to use the LA Solutions MicroStation Detector...
Why not?
Unknown said:I am trying to launch Microstation from an external program using Visual Basic
You want to pass the file name and workspace information to ustation.exe?
If you understand MicroStation's command-line switches, the task is easy enough.
Unknown said:Dim BMAPP As New MicroStationDGN.Application
If you're calling MicroStationDGN.Application then MicroStation is already up and running. It's too late to specify the workspace. You must specify the workspace when you start MicroStation.
Of course, the LA Solutions MicroStation Detector does all that for you already 8-) And, it's freeware.
Regards, Jon Summers LA Solutions