I also tried a couple more things after that last post too. I tried starting Notepad.exe, switching focus to that application, then switching focus back to the Inventor application, then close the Notepad app, to see if that would cause the title to update, but it didn't seem to work (unless I just wasn't doing something right). I created a Sub for this process, and tried putting it after one or both Caption = "" and after Caption = oDef, in the calling Sub.
Sub UpdateAppTitle()
Dim oPID As Integer = Shell("NOTEPAD.EXE", AppWinStyle.NormalFocus)
AppActivate(oPID)
AppActivate(ThisApplication.Caption)
Process.GetProcessById(oPID).CloseMainWindow
End Sub
I also tried capturing the Process.ID of Inventor, to see if I could access the Inventor application from Windows standpoint to explore the options for updating its title. I was able to get the ProcessID, the MainWindowHandle, and the MainWindowTitle (ReadOnly sadly). So I thought I should be able to use that MainWindowHandle to somehow 'refresh' the Inventor application's main window title.
Dim oProc As Process = System.Diagnostics.Process.GetCurrentProcess
Dim oMWHandle As IntPtr = oProc.MainWindowHandle
Dim oMWTitle As String = oProc.MainWindowTitle
I tried something I found here, but it always seemed to just show an error or didn't work, for some reason (you can try it if you want). What did end up working for me, though still not ideal, was the timed message box (shows a MessabeBox for a limited amount of time), which I tried to set to the absolute minimal amount of time and still keep it effective. I'm guessing it works just because it moved the focus back and forth a couple of times. It seems that when you click on the 'Return' button in the Ribbon to return to editing the main assembly, it executes two commands (AssemblyFinishEditCmd & AppReturnPreviousCmd). I set the timer to 150 milliseconds, and it still seems to work, but you still see the MessageBox flash on the screen twice, but it has been updating the application's title correctly each time. I did notice though, if the Description in the other document is too long, it simply won't show anything in the title (maybe an empty string though, because the title moves slightly).
I was using this in the calling Sub (OnNewEditObject), right after editing the Caption, to force the update:
Call MessageBoxTimeOut(0, "", "", vbInformation, 0, 150)
and had this Function below:
' see http://www.pinvoke.net/default.aspx/user32/MessageBoxTimeout.html
<DllImport("user32.dll", setLastError:=True, EntryPoint:="MessageBoxTimeoutW", CharSet:= CharSet.Unicode)> _
Private Shared Function MessageBoxTimeOut( _
ByVal hWnd As IntPtr, _
ByVal lpText As String, _
ByVal lpCaption As String, _
<MarshalAs(UnmanagedType.U4)> ByVal uType As UInteger, _
<MarshalAs(UnmanagedType.U2)> ByVal wLanguage As Int16, _
<MarshalAs(UnmanagedType.U4) > ByVal dwMilliseconds As Int32) As <MarshalAs(UnmanagedType.U4) > UInteger
End Function
And because I'm testing in iLogic, I had to include the following in the 'Header':
Imports System.Runtime.InteropServices
If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.
If you want and have time, I would appreciate your Vote(s) for My IDEAS 💡or you can Explore My CONTRIBUTIONS
Wesley Crihfield

(Not an Autodesk Employee)