hongmei 发表于 2006-8-18 08:33:00

[求助]更改AutoCAD应用程序的图标和标题栏

斑竹,请问AutoCADVBA二次开发教程中第十五章的“更改AutoCAD应用程序的图标和标题栏“的程序能在2004版中应用吗?

wyj7485 发表于 2006-8-18 10:48:00

可以啊

hongmei 发表于 2006-8-18 13:26:00

<P>Public Sub SetTitle(ByVal Title As String)<BR>&nbsp;&nbsp;&nbsp; Dim AcadHwnd As Long<BR>&nbsp;&nbsp;&nbsp; Dim hIcon As Long<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; ' 获取AutoCAD应用程序的窗口句柄<BR>&nbsp;&nbsp;&nbsp; AcadHwnd = GetParent(GetParent(ThisDrawing.hwnd))<BR>&nbsp;&nbsp;&nbsp; ' 设置标题<BR>&nbsp;&nbsp;&nbsp; SetWindowText AcadHwnd, Title<BR>End Sub</P>
<P>Public Sub SetIcon(ByVal FileName As String)<BR>&nbsp;&nbsp;&nbsp; Dim AcadHwnd As Long<BR>&nbsp;&nbsp;&nbsp; Dim hIcon As Long<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; ' 获取AutoCAD应用程序的窗口句柄<BR>&nbsp;&nbsp;&nbsp; AcadHwnd = GetParent(GetParent(ThisDrawing.hwnd))<BR>&nbsp;&nbsp;&nbsp; ' 从文件载入图标,16*16大小<BR>&nbsp;&nbsp;&nbsp; hIcon = LoadImage(0&amp;, FileName, IMAGE_ICON, 32, 32, LR_LOADFROMFILE)<BR>&nbsp;&nbsp;&nbsp; If hIcon &lt;&gt; 0 Then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' 发送消息,设置图标<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Call SendMessage(AcadHwnd, WM_SETICON, 0, ByVal hIcon)<BR>&nbsp;&nbsp;&nbsp; End If<BR>End Sub</P>
<P>各位专家,调试过程中AcadHwnd值总为零,这是什么原因?</P>
<P>&nbsp;</P>

雪山飞狐_lzh 发表于 2006-8-18 20:23:00

Public Sub SetCaption(ByVal NewCaption As String)<BR>&nbsp;&nbsp;&nbsp; SetWindowText Application.hwnd, NewCaption<BR>End Sub<BR>

hao2913941 发表于 2011-2-16 17:12:00

哪里有AutoCADVBA二次开发教程可买?
页: [1]
查看完整版本: [求助]更改AutoCAD应用程序的图标和标题栏