We wrote this solution in response to a question posed on the Be Community Forums. MicroStation provides between one and eight view windows that are the primary interface between a user and the CAD tool. Usually, a view window's title is something like View 1: Top View. However, an application may want to append text to the standard caption, or perhaps replace it entirely.

Q How do I append text to a MicroStation view window's title bar?

Example Custom View Title

A A simple question, which turns out to have a complex answer. The old way does not provide a permanent solution: we need to turn to the MicroStationAPI for that.

MicroStation V8 2004 Edition

In the good old days you could call mdlWindow_titleSet (mdlWindow_viewWindowGet (viewIndex). But with MicroStation V8i life is more difficult, and we have to use other techniques. Those other techniques involve the MicroStationAPI.

The reason for the change is that MicroStation has become more sophisticated. A view window, in the V8i era, is dynamic — no longer is it a simple static view of a DGN model. Hence, it no longer has a static caption. Using the above MDL code with V8i changes the caption, but the change is not persistent.

MicroStationAPI: View Interfaces

The C++ MicroStationAPI provides the solution we want for MicroStation CONNECT and MicroStation V8i. There are various public interfaces, including those relevant to this solution: IViewManager and IViewMonitor. IViewMonitor lets us override view callback methods with our own implementation; IViewManager lets us inform MicroStation that a view has changed because we have modified its title.

MicroStationAPI: IViewMonitor

For this solution, our class MyViewMonitor inherits from IViewMonitor. IViewMonitor is an abstract class with several virtual callback methods. We're interested in only one of those methods …

virtual void IViewMonitor::_OnGetViewTitle (IViewportP vp, WStringR title);

Our class method provides a custom implementation of that method. We determine the view number of the Viewport and append our text to its current title. The current title is usually the default caption (e.g. View 3 - Front). It's our decision, in this example, to append text to the current title: you could replace the title completely if required.

Running SetViewTitle

Type mdl load SetViewTitle in MicroStation's keyin window. Commands available include …

SetViewTitle stores up to eight suffix strings, one for each MicroStation view. You can set and reset each suffix independently.

Building SetViewTitle

We assume that you are using the MicroStation development environment to build this project. Consult the Software Development Kit (SDK) help for more information, or take a look at our guide to setting up Windows to build MicroStation applications.

As with any MicroStation application built for native code, the result is in two parts: SetViewTitle.ma and SetViewTitle.dll. File SetViewTitle.ma contains only resource data: in this case, the information MicroStation requires to load the DLL, and a command table. SetViewTitle.dll is the implementation file. When a user types mdl load SetViewTitle MicroStation first loads SetViewTitle.ma and finds the resource directive (the DllMdlApp in SetViewTitle.r) that instructs it to load a DLL, then it loads SetViewTitle.dll.

Download SetViewTitle

Download SetViewTitle

Download the SetViewTitle project. This ZIP file contains C++ source code header and implementation files, and a bmake (.mke) file to build the project.

Check the version of Visual Studio you need to build this project. We built this project for MicroStation V8i and have not modified it for MicroStation CONNECT.