Hi,
I want to programatically remove the AutoCAD icon coming at the extreme top of AUTOCAD application
(I am using C# to customize the AutoCAD application)
Is there any API where i can show customized icon instead of AUTOCAD icon.
If above is not possible is there any way to reduce the size of that icon?
Thanks in advance!
Regards,
Avadhut K
Prior to AutoCAD 2009 (e.g. before the ribbon and the big icon button at top left of Acad main window were introduced), you can use Windows API to set AutoCAD's main window icon and title. See the picture below were the icon and title of AutoCAD's main window has been changed to custom icon and text:
However, since AutoCAD 2009, the same Window API code that changes Window's icon has no effect any more, though the windows title can still be changed. I guess, because of the AUtoCAD main windows icon is not just an icon, it is a function button. I do not think you can change it, nor Autodesk wamts you to change it.
Thanks for reply,
Can you share the API name so that i can verify if it is possible to change the icon?
As I said, changing icon with Win API only works with Acad2008 or older. The picture shown in my previous reply is with Acad2008. I have Acad2006/2008/2009/2011 installed with my various computers. I have tried it with Acad2009 and later. Here is the code anyway:
public class WinAPI { public const int WM_SETICON = 0x80; public const int IMAGW_ICON = 1; public const int LR_LOADFROMFILE = 0x10; [DllImport("User32.dll", EntryPoint = "SendMessage")] public static extern int SendMessage( int hWnd, int Msg, int wParam, int IParam); [DllImport("User32.dll", EntryPoint = "LoadImage")] public static extern int LoadImageA(int hInst, string Ipsz, int un1, int n1, int n2, int un2); [DllImport("User32.dll", EntryPoint = "SetWindowText")] public static extern int SetWindowTextA(int hwnd, string IpString); }
public class MyClass : IExtensionApplication { #region IExtensionApplication Members public void Initialize() { try { SetAcadWindowTitleAndIcon(); } catch { } } public void Terminate() { } #endregion private static void SetAcadWindowTitleAndIcon() { AcadApplication app = Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication as AcadApplication; int wHnd = app.HWND; //Set title string title = "AutoCAD with XXXX Tool"; WinAPI.SetWindowTextA(wHnd, title); //Set icon string iconFile = "E:\\Work\\Acad\\OIcon.ico"; if (System.IO.File.Exists(iconFile)) { int hIcon = WinAPI.LoadImageA(0, iconFile, WinAPI.IMAGW_ICON, 16, 16, WinAPI.LR_LOADFROMFILE); if (hIcon != 0) { WinAPI.SendMessage(wHnd, WinAPI.WM_SETICON, 0, hIcon); } } }
Now there's a go-getter type of person!
Hello
I'm looking for a program that do it, i'm using AutoCAD 2008
I copy your code and paste in a C# but i have some questions
I add references
autodesk.autocad.interop.
autodesk.autocad.interop.common
acmgdinternal
acmgd
dotnetarx
what else i need to run this routine and where i need to place the program
thanks a lot.
you're so intelligent