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
改动一下加上下面一段Lisp代码可以在Lisp中调用,:)
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, ThisDrawing.GetVariable("Users1") End Sub
(defun tsac(newtext) (setq oldstr (getvar "users1")) (setvar "users1" newtext) (vla-runmacro (vlax-get-acad-object) "SetAcadTitle") (setvar "users1" oldstr) )