<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Customize AutoCAD icon coming at the extreme top of AUTOCAD applicatio​n. in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/customize-autocad-icon-coming-at-the-extreme-top-of-autocad/m-p/2978394#M61276</link>
    <description>&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;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);
    }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;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);
                }
            }
        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 05 Apr 2011 14:24:43 GMT</pubDate>
    <dc:creator>norman.yuan</dc:creator>
    <dc:date>2011-04-05T14:24:43Z</dc:date>
    <item>
      <title>Customize AutoCAD icon coming at the extreme top of AUTOCAD applicatio​n.</title>
      <link>https://forums.autodesk.com/t5/net-forum/customize-autocad-icon-coming-at-the-extreme-top-of-autocad/m-p/2978032#M61273</link>
      <description>&lt;DIV class="lia-component-body lia-message-body"&gt;&lt;DIV class="lia"&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to programatically remove the AutoCAD icon coming at the extreme top of AUTOCAD application&lt;/P&gt;&lt;P&gt;(I am using C# to customize the AutoCAD application)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any API where i can show customized icon instead of AUTOCAD icon.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If&amp;nbsp;above is not possible is there any way to reduce the size of that icon?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Avadhut K&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 05 Apr 2011 10:49:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/customize-autocad-icon-coming-at-the-extreme-top-of-autocad/m-p/2978032#M61273</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-04-05T10:49:06Z</dc:date>
    </item>
    <item>
      <title>Re: Customize AutoCAD icon coming at the extreme top of AUTOCAD applicatio​n.</title>
      <link>https://forums.autodesk.com/t5/net-forum/customize-autocad-icon-coming-at-the-extreme-top-of-autocad/m-p/2978352#M61274</link>
      <description>&lt;P&gt;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&amp;nbsp;below were&amp;nbsp;the icon and title of AutoCAD's main window has been changed to custom icon and text:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG align="center" alt="untitled.GIF" border="0" src="http://forums.autodesk.com/t5/image/serverpage/image-id/6112i6BAC146E9F6D8C03/image-size/original?v=mpbl-1&amp;amp;px=-1" title="untitled.GIF" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2011 14:01:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/customize-autocad-icon-coming-at-the-extreme-top-of-autocad/m-p/2978352#M61274</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2011-04-05T14:01:04Z</dc:date>
    </item>
    <item>
      <title>Re: Customize AutoCAD icon coming at the extreme top of AUTOCAD applicatio​n.</title>
      <link>https://forums.autodesk.com/t5/net-forum/customize-autocad-icon-coming-at-the-extreme-top-of-autocad/m-p/2978382#M61275</link>
      <description>&lt;P&gt;Thanks for reply,&lt;/P&gt;&lt;P&gt;Can you share the API name so that i can verify if it is possible to change the icon?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2011 14:17:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/customize-autocad-icon-coming-at-the-extreme-top-of-autocad/m-p/2978382#M61275</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-04-05T14:17:43Z</dc:date>
    </item>
    <item>
      <title>Re: Customize AutoCAD icon coming at the extreme top of AUTOCAD applicatio​n.</title>
      <link>https://forums.autodesk.com/t5/net-forum/customize-autocad-icon-coming-at-the-extreme-top-of-autocad/m-p/2978394#M61276</link>
      <description>&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;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);
    }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;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);
                }
            }
        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2011 14:24:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/customize-autocad-icon-coming-at-the-extreme-top-of-autocad/m-p/2978394#M61276</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2011-04-05T14:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: Customize AutoCAD icon coming at the extreme top of AUTOCAD applicatio​n.</title>
      <link>https://forums.autodesk.com/t5/net-forum/customize-autocad-icon-coming-at-the-extreme-top-of-autocad/m-p/2978436#M61277</link>
      <description>&lt;P&gt;OK.&lt;/P&gt;&lt;P&gt;Thanks I will try it in AutoCAD 2011 64 bit.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2011 14:35:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/customize-autocad-icon-coming-at-the-extreme-top-of-autocad/m-p/2978436#M61277</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-04-05T14:35:23Z</dc:date>
    </item>
    <item>
      <title>Re: Customize AutoCAD icon coming at the extreme top of AUTOCAD applicatio​n.</title>
      <link>https://forums.autodesk.com/t5/net-forum/customize-autocad-icon-coming-at-the-extreme-top-of-autocad/m-p/2981966#M61278</link>
      <description>&lt;P&gt;Now there's a go-getter type of person!&amp;nbsp; &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2011 12:36:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/customize-autocad-icon-coming-at-the-extreme-top-of-autocad/m-p/2981966#M61278</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-04-07T12:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: Customize AutoCAD icon coming at the extreme top of AUTOCAD applicatio​n.</title>
      <link>https://forums.autodesk.com/t5/net-forum/customize-autocad-icon-coming-at-the-extreme-top-of-autocad/m-p/3112230#M61279</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm looking for a program that do it, i'm using AutoCAD 2008&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I copy your code and paste in a C# but i have some questions&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I add references&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;autodesk.autocad.interop.&lt;/P&gt;&lt;P&gt;autodesk.autocad.interop.common&lt;/P&gt;&lt;P&gt;acmgdinternal&lt;/P&gt;&lt;P&gt;acmgd&lt;/P&gt;&lt;P&gt;dotnetarx&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what else i need to run this routine and where i need to place the program&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks a lot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you're so intelligent&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2011 14:27:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/customize-autocad-icon-coming-at-the-extreme-top-of-autocad/m-p/3112230#M61279</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-08-03T14:27:26Z</dc:date>
    </item>
  </channel>
</rss>

