Launching MicroStation hidden from VB

Status
Not open for further replies.

Lloyd Charlier

Usenet Archive
Joined
Nov 27, 2001
Messages
7
Reaction score
0
Can anyone tell me how to reliably manipulate MicroStation from VB using OLE such that MicroStation remains invisible? I can successfully connect to a running instance of MS (using GetObject) and I can successfully instantiate a new MS object (using CreateObject) but I have, as of yet, been unable to do the latter without MS running visibly. I have tried setting the MS object visibility property "off" but to no avail (I have tried both setting msApp.Visible=False and msApp.Visible=0). No errors are generated but no change is noted either!

Some postings on this newsgroup have suggested an alternative approach whereby one spawns (programmatically) "ustation.exe" with the "/Automation" switch. While this indeed launches MS for me, I have still not seen it run hidden. If I launch "ustation.exe /Automation" from a command window, it does appear to run hidden however... (huh?) Regardless, this approach seems really backward to me. Isn't there a more elegant way of doing what I want to do?

I do not pretend to be a MS expert so please feel free to point out the stupidity of my ways... <grin>

Thanks in advance for any-and-all assistance.

Regards,

Lloyd
 
Well... I was going to recommmend the ShowWindow API, but I wasn't able to test it for you.

When I do the following:
Set objMicrostationApp = CreateObject("Microstation.application")

I get an instance of ustation.exe running that is invisible. In fact, it refuses to become visible. :)

I'd try the ShowWindow API though... it isn't hard to use, and it should work. Here is an example:
http://www.vbapi.com/ref/s/showwindow.html

Good luck.

"Lloyd Charlier" wrote:
Can anyone tell me how to reliably manipulate MicroStation from VB using OLE such that MicroStation remains invisible? I can successfully connect to a running instance of MS (using GetObject) and I can successfully instantiate a new MS object (using CreateObject) but I have, as of yet, been unable to do the latter without MS running visibly. I have tried setting the MS object visibility property "off" but to no avail (I have tried both setting msApp.Visible=False and msApp.Visible=0). No errors are generated but no change is noted either!

Some postings on this newsgroup have suggested an alternative approach whereby one spawns (programmatically) "ustation.exe" with the "/Automation" switch. While this indeed launches MS for me, I have still not seen it run ...
 
Thanks for the suggestion. Unfortunately, what I have learned since I posted the first message appears to complicate things more...

I too have noted that MicroStation itself (no drawing loaded) does indeed load "invisible" when invoked via GetObject/CreateObject. The visibility problem arises when I attempt to programmatically instruct MS to load a drawing ("MbeCommand NEWFILE filename.dgn"). Any attempt at doing such automatically forces MS into visible GUI mode. Strangely enough, at this point, when I issue the ShowWindow command, MS refuses to hide. I have even tried re-assigning it's parent window definition such that it is a child of an invisible form. Still no luck! The #^&$! window still remains visible!

One last thing to try is to move the MS app window off-screen into negative virtual space. It shouldn't be this hard - Hopefully MS v8 will simplify things greatly due to its VBA and OLE support...

Thanks again for your help!

Lloyd

"LMH" wrote:

Well... I was going to recommmend the ShowWindow API, but I wasn't able to test it for you.

When I do the following:
Set objMicrostationApp = CreateObject("Microstation.application")

I get an instance of ustation.exe running that is invisible. In fact, it refuses to become visible. :)

I'd try the ShowWindow API though... it isn't hard to use, and it should work. Here is an example:
http://www.vbapi.com/ref/s/showwindow.html
...
...
> Can anyone tell me how to reliably manipulate MicroStation from VB using
OLE
> such that MicroStation remains invisible? I can successfully connect to
a
> running instance of MS (using GetObject) and I can successfully
instantiate
> a new MS object (using CreateObject) but I have, as of yet, been unable
to
> do the latter without MS running visibly. I have tried setting the MS
> object visibility property "off" but to no avail (I have tried both
setting
> msApp.Visible=False and msApp.Visible=0). No errors are generated but
no
> change is noted either!
>
> Some postings on this newsgroup have suggested an alternative approach
> whereby one spawns (programmatically) "ustation.exe" with the
"/Automation"
> switch. While this indeed launches MS for me, I have still not seen it
run
> hidden. If I launch "ustation.exe /Automation" from a command window,
it
> does appear to run hidden however... (huh?) Regardless, this approach
seems
> really backward to me. Isn't there a more elegant way of doing what I
want
> to do?
>
> I do not pretend to be a MS expert so please feel free to point out the
> stupidity of my ways... <grin>
>
> Thanks in advance for any-and-all assistance.
>
> Regards,
>
> Lloyd
 
Status
Not open for further replies.

Latest threads

Back
Top