天气与日历 切换到窄版

 找回密码
 立即注册
中国膜结构网
十大进口膜材评选 十大国产膜材评选 十大膜结构设计评选 十大膜结构公司评选
查看: 49|回复: 0

‎更改显示的 AutoCAD 标题栏文本‎

[复制链接]

该用户从未签到

主题

0

回帖

2912

积分

管理员

积分
2912
发表于 2024-6-22 09:46:18 | 显示全部楼层 |阅读模式
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





Sub test()

        Const progID As String =  

                  "AutoCAD.Application.18"



        Dim acType As Type = _

            Type.GetTypeFromProgID(progID)

        Dim AcadApp As AcadApplication = Nothing



        AcadApp =

         CType(Activator.CreateInstance(acType, True),

                AcadApplication)



        System.Threading.Thread.Sleep(2000)



        AcadApp.Visible = True



        Dim acadhnd As Long

        Dim titletxt As String

        Dim curtxt As String



        titletxt = "This is my version of AutoCAD"

        curtxt = Space(256)



        'Obtains the handle of AutoCAD window.

        'acadhnd = GetActiveWindow

        ' use the AutoCAD caption to get the handle

        acadhnd = FindWindow(vbNullString,

                               AcadApp.Caption)



        'Obtain the current text in the titlebar.

        GetWindowText(acadhnd, curtxt, 125)

        MsgBox(curtxt)



        'Set the desired text for the titlebar.

        SetWindowText(acadhnd, titletxt)

End Sub

 

 

 

 

‎更改显示的 AutoCAD 标题栏文本‎
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|中国膜结构网|中国膜结构协会|进口膜材|国产膜材|ETFE|PVDF|PTFE|设计|施工|安装|车棚|看台|污水池|中国膜结构网_中国空间膜结构协会

GMT+8, 2024-11-1 11:45 , Processed in 0.164849 second(s), 28 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表