Issue
Is it possible to change the text displayed in the AutoCAD title bar?
Solution
With ObjectARX you can do the following:
static void test()
{
acedGetAcadFrame()->SetWindowText (
_T("My AutoCAD"));
}
There is no AutoLISP or AutoCAD ActiveX API that will set this because the AutoCAD ActiveX Application Object's Caption Property is read-only. However, you can use the Win32 API functions, GetActiveWindow and SetWindowText. Following is a code demo of VB.NET.
' declare the global functions of Windows
Public Declare Function _
GetActiveWindow Lib "user32" () As Long
Public Declare Function _
GetWindowText Lib "user32" Alias _
"GetWindowTextA" ( _
ByVal hwnd As Long, _
ByVal lpString As String, _
ByVal cch As Long) As Long
Public Declare Function _
SetWindowText Lib "user32" Alias _
"SetWindowTextA" ( _
ByVal hwnd As Long, _
ByVal lpString As String) As Long
Public Declare Function _
FindWindow Lib "user32" Alias _
"FindWindowA" ( _
ByVallpClassName As String, _
ByVal lpWindowName As String) As Long

Leave a Reply