Hi,
I've just started looking to test what can be displayed in the title bar and I am finding that I am getting additional numbers with brackets after at the end of the information I want displayed. I'm running dual screens and the Left monitor by default has a (1) in the title bar and the right a (2). Now I'm getting (1) (2) (1) on the left and (1) (2) (1) (2) on the right but I cant figure out why these are appearing. I would prefer that none were visible at all if possible. The code I have been using is :
Public Sub hooks_OnDesignFileOpened(ByVal fileName As String) Dim UsersName As String Dim FullPath As String Const str_USTN_USERNAME As String = "$(_USTN_USERNAME)" Const str_DGNFILE As String = "$(_DGNFILE)" UsersName = ActiveWorkspace.ExpandConfigurationVariable(str_USTN_USERNAME) FullPath = ActiveWorkspace.ExpandConfigurationVariable(str_DGNFILE) Application.Caption = FullPath & " : " & UsersName & " : " Debug.Print "Application.Caption"End Sub
In addition to this:
Thanks
Application.Caption = <String>
<String> can be anything you want. If you want, you could do Application.Caption = "The World's Greatest Program running on " & Date() . All you have to do is create a string that reads how you want it to.
--Robert
I posted a similar observation months ago and never heard a peep from anyone. Apparently, the code that adds the screen number does not play well with the caption method/property.
Charles (Chuck) Rheault CADD Manager
MDOT State Highway Administration Maryland DOT - State Highway Administration User Communities Page
Robert, many thanks
Caddcop, thanks also. Were you told why the default title bar information doesn't have that behavior? Could it perhaps use a different method for displaying title bar information than using application.caption perhaps? I've found simply adding lots of information on the " Application.Caption = " pushes the offending bracketed numbers out of sight but it does leave ... just to the left of the minimise button whilst not ideal is better than what it was.
Sadly, this was one of my orphan posts. The silence was deafening.
Hehe :)
One issue has since become apparent when using a modified title bar. When switching models, the title bar reverts to the default setting. I know the code sets the title on design file load but can the same be done for switching between models?
Look in the Microstation-VBA help for IModelActivateEvents
A workaroud is as below:
Declare Function mdlNativeWindow_getMainHandle Lib "stdmdlbltin.dll" (ByVal iScreen As Long) As LongDeclare Function SetWindowTextA Lib "user32.dll" (ByVal hwnd As Long, ByVal lpString As String) As BooleanSub SetDualScreenAppTitle(iScreen As Long, title As String) Dim winHandle As Long winHandle = mdlNativeWindow_getMainHandle(iScreen) SetWindowTextA winHandle, titleEnd SubSub Test() SetDualScreenAppTitle 0, "Screen 0" SetDualScreenAppTitle 1, "Screen 1"End Sub
HTH, Yongan.Fu
It might sound a simple question but how do I use this code along with my custom title?
Copy and paste Fu's example code into a VBA module. Place your cursor in the 'Test' subroutine, and run. You should see the Window captions change. If that does what you want, then change 'Screen 0' and 'Screen 1' to your title.
Regards, Jon Summers LA Solutions