<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://communities.bentley.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Application.Caption Issue</title><link>https://communities.bentley.com/products/programming/microstation_programming/f/archived-microstation-v8i-vba-forum/61653/application-caption-issue</link><description>Hi, 
 I&amp;#39;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&amp;#39;m running dual screens and the Left monitor by</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>Re: Application.Caption Issue</title><link>https://communities.bentley.com/thread/150759?ContentTypeID=1</link><pubDate>Wed, 17 Nov 2010 14:49:48 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:82ceac2a-27c8-4c5f-b5ba-eb468d2223a5</guid><dc:creator>Barry Lothian</dc:creator><description>&lt;p&gt;Wow many thanks Fu, that solution works perfectly.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Application.Caption Issue</title><link>https://communities.bentley.com/thread/150755?ContentTypeID=1</link><pubDate>Wed, 17 Nov 2010 13:28:27 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:0deff62a-f3f8-4167-b346-3676fada8ca3</guid><dc:creator>Jon Summers</dc:creator><description>&lt;h4&gt;&lt;span style="color:SeaGreen;"&gt; IEnterIdle&lt;/span&gt; &lt;/h4&gt;
&lt;p&gt;
[quote user=&amp;quot;Yongan Fu&amp;quot;]
The following way maybe a good choice for you--hooking MicroStation&amp;#39;s new &lt;i&gt;EnterIdle&lt;/i&gt; event.
[/quote]
&lt;/p&gt;
&lt;p&gt;
Thanks for pointing that out.
The &lt;i&gt;EnterIdle&lt;/i&gt; event crept stealthily into the V8i API. 
It&amp;#39;s helpful to have someone point out new features!
&lt;/p&gt;

&lt;p&gt;
Regards, Jon Summers
&lt;br /&gt;
&lt;a href="http://www.la-solutions.co.uk"&gt;LA Solutions&lt;/a&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Application.Caption Issue</title><link>https://communities.bentley.com/thread/150732?ContentTypeID=1</link><pubDate>Wed, 17 Nov 2010 07:02:05 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:5dfe2533-61a8-4097-b120-1df1f2d7d388</guid><dc:creator>Yongan.Fu</dc:creator><description>&lt;p&gt;If you don&amp;#39;t familiar with MDL, forget it although you can learn it after you install MicroStation SDK (can download this SDK from SELECTServices). The following way maybe a good choice for you--hooking MicroStation&amp;#39;s new EnterIdle event to set the dual screen application title. And after using this, you don&amp;#39;t need to hook ModelActivateEvent anymore.&lt;/p&gt;
&lt;p&gt;1. Your code module is as below:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Declare Function mdlNativeWindow_getMainHandle Lib &amp;quot;stdmdlbltin.dll&amp;quot; (ByVal iScreen As Long) As Long&lt;br /&gt;Declare Function SetWindowTextA Lib &amp;quot;user32.dll&amp;quot; (ByVal hwnd As Long, ByVal lpString As String) As Boolean&lt;br /&gt;Sub SetDualScreenAppTitle(iScreen As Long, title As String)&lt;br /&gt;&amp;nbsp;&amp;nbsp; Dim winHandle As Long&lt;br /&gt;&amp;nbsp;&amp;nbsp; winHandle = mdlNativeWindow_getMainHandle(iScreen)&lt;br /&gt;&amp;nbsp;&amp;nbsp; SetWindowTextA winHandle, title&lt;br /&gt;End Sub&lt;br /&gt;Sub OnProjectLoad()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; AddEnterIdleEventHandler New clsEnterIdle&lt;br /&gt;End Sub&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;2. Your class module is as below: (NOTE, the class name must be &amp;#39;clsEnterIdle&amp;#39;)&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Implements IEnterIdleEvent&lt;br /&gt;Private Sub IEnterIdleEvent_EnterIdle(ByVal Reserved As Long)&lt;br /&gt;&amp;nbsp;&amp;nbsp; SetDualScreenAppTitle 0, &amp;quot;Screen 0&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp; SetDualScreenAppTitle 1, &amp;quot;Screen 1&amp;quot;&lt;br /&gt;End Sub&lt;/code&gt;HTH, Yongan.Fu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Application.Caption Issue</title><link>https://communities.bentley.com/thread/150595?ContentTypeID=1</link><pubDate>Tue, 16 Nov 2010 12:43:21 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:d3877940-1dd1-4ce6-8146-6e62bef69f03</guid><dc:creator>Barry Lothian</dc:creator><description>&lt;p&gt;Hi and thanks.&lt;/p&gt;
&lt;p&gt;That all sounds very simple however I have zero programming experience and I have no idea how to go about creating an MDL app. I&amp;#39;ve just browsed through some MDL code examples in the programming wiki and it looks very confusing to someone not familiar with MDL.&lt;/p&gt;
&lt;p&gt;Is there documentation provided that is suitable for someone in my position (basically MDL for dummies?) that explains the how to go about creating an MDL application i.e. well written example code that it fully explained similar to what Microsoft&amp;#39;s &lt;a href="http://blogs.technet.com/b/heyscriptingguy/" title="Hey, Scripting Guy! blog"&gt;Hey, Scripting Guy blog&lt;/a&gt; does so that someone trying to learn isn&amp;#39;t going to be confused by the subject?&lt;/p&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;p&gt;Is the documention provided by Bentley geared towards people who are familiar with programming?&lt;/p&gt;
&lt;p&gt;If there&amp;#39;s not then it likely I&amp;#39;m going to have to forget this entirely.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Application.Caption Issue</title><link>https://communities.bentley.com/thread/150589?ContentTypeID=1</link><pubDate>Tue, 16 Nov 2010 11:14:37 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:58c56da5-5b41-45bb-b75f-ddf12727e678</guid><dc:creator>Yongan.Fu</dc:creator><description>&lt;p&gt;Hi I3loom,&lt;/p&gt;
&lt;p&gt;I think when the macro OnProjectLoad is executing, the MicroStation&amp;#39;s main window has not been initialized.&lt;/p&gt;
&lt;p&gt;You can solve this probelm by following way:&lt;/p&gt;
&lt;p&gt;1. Desgin a simple MDL application as a initapp.&lt;/p&gt;
&lt;p&gt;2. In this MDL application, you send a command to the end of MicroStation&amp;#39;s input queue, thus give MicroStation &amp;nbsp;a chance to initialize and complete its start.&lt;/p&gt;
&lt;p&gt;3. In this command function, you load your VBA project.&lt;/p&gt;
&lt;p&gt;HTH, Yongan.Fu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Application.Caption Issue</title><link>https://communities.bentley.com/thread/150522?ContentTypeID=1</link><pubDate>Mon, 15 Nov 2010 21:12:21 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:4ec6f075-2c9b-4fbd-a8f4-b4b797833e10</guid><dc:creator>Barry Lothian</dc:creator><description>&lt;p&gt;Thanks Jon&lt;/p&gt;
&lt;p&gt;I did as you said and sure enough the monitor titles do change to Screen 0 and Screen 1.&lt;/p&gt;
&lt;p&gt;So I&amp;#39;ve now tried to get this to load each time I open a file so I&amp;#39;ve merged Fu&amp;#39;s code with some of my former code so its now all in a single Code Module and looks like:&lt;/p&gt;
&lt;p&gt;&lt;blockquote style="overflow-x: scroll;"&gt;&lt;pre style="margin: 0px;"&gt;Option Explicit&lt;br /&gt;Private m_oOpenClose As clsOpenClose&lt;br /&gt;&amp;#39; ---------------------------------------------------------------------&lt;br /&gt;Const strMODULE_NAME                            As String = &amp;quot;modMain&amp;quot;&lt;br /&gt;Declare Function mdlNativeWindow_getMainHandle Lib &amp;quot;stdmdlbltin.dll&amp;quot; (ByVal iScreen As Long) As Long&lt;br /&gt;Declare Function SetWindowTextA Lib &amp;quot;user32.dll&amp;quot; (ByVal hwnd As Long, ByVal lpString As String) As Boolean&lt;br /&gt;Sub SetDualScreenAppTitle(iScreen As Long, title As String)&lt;br /&gt;   Dim winHandle As Long&lt;br /&gt;   winHandle = mdlNativeWindow_getMainHandle(iScreen)&lt;br /&gt;   SetWindowTextA winHandle, title&lt;br /&gt;End Sub&lt;br /&gt;Public Sub OnProjectLoad()&lt;br /&gt;    Set m_oOpenClose = New clsOpenClose&lt;br /&gt;    Dim UsersName                           As String&lt;br /&gt;    Dim File                                As String&lt;br /&gt;    Const strUsers_Full_Name                As String = &amp;quot;$(_FullName)&amp;quot;&lt;br /&gt;    Const str_DGNFILE                       As String = &amp;quot;$(_DGNFILE)&amp;quot;&lt;br /&gt;    UsersName = ActiveWorkspace.ExpandConfigurationVariable(strUsers_Full_Name)&lt;br /&gt;    File = ActiveWorkspace.ExpandConfigurationVariable(str_DGNFILE)&lt;br /&gt;    SetDualScreenAppTitle 0, File&lt;br /&gt;    SetDualScreenAppTitle 1, &amp;quot;Current User: &amp;quot; &amp;amp; UsersName &amp;amp; &amp;quot; - Todays Date: &amp;quot; &amp;amp; Date&lt;br /&gt;End Sub&lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
&lt;p&gt;The problem is that its not changing the title automatically as it was previously. If I run it manually it does work so I can&amp;#39;t understand why its not working when I open a drawing but then again I know nothing about VBA so I&amp;#39;m probably making an obvious error.&lt;/p&gt;
&lt;p&gt;Also, I&amp;#39;ve been trying to understand IModelActivateEvents as per Roberts suggestion. Can you script it so that the same code used in the openclose class is run each time a model change is activated? The end result I want is a custom title bar that remains visible in all models.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Application.Caption Issue</title><link>https://communities.bentley.com/thread/150509?ContentTypeID=1</link><pubDate>Mon, 15 Nov 2010 20:01:21 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:d5841943-b82f-4939-a952-0f76baeeed6c</guid><dc:creator>Jon Summers</dc:creator><description>&lt;p&gt;Copy and paste Fu&amp;#39;s example code into a VBA module. &amp;nbsp;Place your cursor in the &amp;#39;Test&amp;#39; subroutine, and run. &amp;nbsp;You should see the Window captions change. &amp;nbsp;If that does what you want, then change &amp;#39;Screen 0&amp;#39; and &amp;#39;Screen 1&amp;#39; to your title. &amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Application.Caption Issue</title><link>https://communities.bentley.com/thread/150493?ContentTypeID=1</link><pubDate>Mon, 15 Nov 2010 18:38:07 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:2163855e-10fa-420e-b594-06bfcd8181b7</guid><dc:creator>Barry Lothian</dc:creator><description>&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;It might sound a simple question but how do I use this code along with my custom title?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Application.Caption Issue</title><link>https://communities.bentley.com/thread/150458?ContentTypeID=1</link><pubDate>Mon, 15 Nov 2010 14:34:29 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:4c1559b2-99d8-401b-a0de-76763bf351f1</guid><dc:creator>Yongan.Fu</dc:creator><description>&lt;p&gt;A workaroud is as below:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Declare Function mdlNativeWindow_getMainHandle Lib &amp;quot;stdmdlbltin.dll&amp;quot; (ByVal iScreen As Long) As Long&lt;br /&gt;Declare Function SetWindowTextA Lib &amp;quot;user32.dll&amp;quot; (ByVal hwnd As Long, ByVal lpString As String) As Boolean&lt;br /&gt;Sub SetDualScreenAppTitle(iScreen As Long, title As String)&lt;br /&gt;&amp;nbsp; &amp;nbsp;Dim winHandle As Long&lt;br /&gt;&amp;nbsp; &amp;nbsp;winHandle = mdlNativeWindow_getMainHandle(iScreen)&lt;br /&gt;&amp;nbsp; &amp;nbsp;SetWindowTextA winHandle, title&lt;br /&gt;End Sub&lt;br /&gt;Sub Test()&lt;br /&gt;&amp;nbsp; &amp;nbsp;SetDualScreenAppTitle 0, &amp;quot;Screen 0&amp;quot;&lt;br /&gt;&amp;nbsp; &amp;nbsp;SetDualScreenAppTitle 1, &amp;quot;Screen 1&amp;quot;&lt;br /&gt;End Sub&lt;br /&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;HTH, Yongan.Fu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Application.Caption Issue</title><link>https://communities.bentley.com/thread/150327?ContentTypeID=1</link><pubDate>Fri, 12 Nov 2010 22:01:58 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:6c3502f3-c1c9-4f73-9ad3-81e67b0b460b</guid><dc:creator>RobertArnold</dc:creator><description>&lt;p&gt;Look in the Microstation-VBA help for IModelActivateEvents&lt;/p&gt;
&lt;p&gt;--Robert&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Application.Caption Issue</title><link>https://communities.bentley.com/thread/150236?ContentTypeID=1</link><pubDate>Fri, 12 Nov 2010 02:11:43 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:c7aff81c-8574-47bb-b36c-4842a2311314</guid><dc:creator>Barry Lothian</dc:creator><description>&lt;p&gt;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?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Application.Caption Issue</title><link>https://communities.bentley.com/thread/150135?ContentTypeID=1</link><pubDate>Thu, 11 Nov 2010 17:03:16 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:449f4596-36c3-4d31-96f0-16d3c4e57a46</guid><dc:creator>Barry Lothian</dc:creator><description>&lt;p&gt;Hehe :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Application.Caption Issue</title><link>https://communities.bentley.com/thread/150132?ContentTypeID=1</link><pubDate>Thu, 11 Nov 2010 16:42:08 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:92fbcf02-5a57-4978-96f4-c9bb8b19e701</guid><dc:creator>caddcop</dc:creator><description>&lt;p&gt;Sadly, this was one of my orphan posts. The silence was deafening.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Application.Caption Issue</title><link>https://communities.bentley.com/thread/150120?ContentTypeID=1</link><pubDate>Thu, 11 Nov 2010 14:11:53 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:5439e843-1e45-4da2-a0fc-a9227de185b4</guid><dc:creator>Barry Lothian</dc:creator><description>&lt;p&gt;Robert, many thanks&lt;/p&gt;
&lt;p&gt;Caddcop, thanks also. Were you told why the default title bar information doesn&amp;#39;t have that behavior? Could it perhaps use a different method for displaying title bar information than using application.caption perhaps? I&amp;#39;ve found simply adding lots of information on the &amp;quot; Application.Caption = &amp;quot; 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.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Application.Caption Issue</title><link>https://communities.bentley.com/thread/150097?ContentTypeID=1</link><pubDate>Thu, 11 Nov 2010 06:20:02 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:0a288b68-4558-4c8c-915e-e7c0450365e7</guid><dc:creator>caddcop</dc:creator><description>&lt;p&gt;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.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Application.Caption Issue</title><link>https://communities.bentley.com/thread/150095?ContentTypeID=1</link><pubDate>Thu, 11 Nov 2010 05:00:02 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:5bf9ae81-0498-475f-beb1-eeb52b36441f</guid><dc:creator>RobertArnold</dc:creator><description>&lt;p&gt;Hi, &lt;/p&gt;
&lt;p&gt;Application.Caption = &amp;lt;String&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;String&amp;gt; can be anything you want. &amp;nbsp;If you want, you could do Application.Caption = &amp;quot;The World&amp;#39;s Greatest Program running on &amp;quot; &amp;amp; Date() . &amp;nbsp;All you have to do is create a string that reads how you want it to.&lt;/p&gt;
&lt;p&gt;--Robert&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>