通过VBA及WINAPI设置AutoCAD软件窗口标题
Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As LongPublic 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<BR>Public Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long<BR>Sub SetAcadTitle()<BR> Dim hw&<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]