mccad 发表于 2002-9-18 12:31:00

通过VBA及WINAPI设置AutoCAD软件窗口标题

Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
Public Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long

Sub SetAcadTitle()
Dim hw&
hw = GetParent(GetParent(ThisDrawing.hwnd))
SetWindowText hw, "明经通道 http://www.mjtd.com"
End Sub

zzz8662 发表于 2004-9-12 18:15:00

把这些代码放什么地方呢?

ntchjie 发表于 2004-9-12 19:59:00

多谢,这个很有用,又学习了一招。


老大,最后一句后面多了各分号,是不是?

雪山飞狐_lzh 发表于 2004-9-12 21:02:00

改动一下加上下面一段Lisp代码可以在Lisp中调用,:)


Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long<BR>Public Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long<BR>Sub SetAcadTitle()<BR>       Dim hw&amp;<BR>       hw = GetParent(GetParent(ThisDrawing.hwnd))<BR>       SetWindowText hw, ThisDrawing.GetVariable("Users1")<BR>End Sub


<BR>(defun tsac(newtext)<BR>(setq oldstr (getvar "users1"))<BR>(setvar "users1" newtext)<BR>(vla-runmacro (vlax-get-acad-object) "SetAcadTitle")<BR>(setvar "users1" oldstr)<BR>)<BR>
页: [1]
查看完整版本: 通过VBA及WINAPI设置AutoCAD软件窗口标题