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