How do I change the icon of the command plugin

On 09/11/2013 at 20:24, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R15 
Platform:   Windows  ;   Mac OSX  ; 
Language(s) :     C++  ;

---------
Because want to switch to two icons icon command plugin
I was going to change in the GetIcon Sign up for RegisterIcon first, but it can not be renamed.
Can I change what I do?

Filename   fn= GeGetPluginPath()+Filename("res")+Filename("Icon.tif");
AutoAlloc<BaseBitmap> bmp;
if (IMAGERESULT_OK != bmp->Init(fn)) return false;
RegisterIcon(ID_IconA, bmp, 0 * 32, 0, 32, 32, ICONFLAG_COPY);
RegisterIcon(ID_IconB, bmp, 1 * 32, 0, 32, 32, ICONFLAG_COPY);

Bool Message(Int32 type, void* data)
{
    switch(type)
    {
     case MSG_GETCUSTOMICON:
        {
            GetCustomIconData *icon =((GetCustomIconData* )data);
            if(flag) GetIcon(ID_IconA,icon->dat);
            else GetIcon(ID_IconB,icon->dat);   
            icon->filled=TRUE;
        }
        break;
    }
    return true;
}

On 10/11/2013 at 03:08, xxxxxxxx wrote:

Hi anoano,

here's a Python version of how you can change the icon for a CommandData plugin. The
MSG_GETCUSTOMICON message is for NodeData plugins only.

https://plugincafe.maxon.net/topic/7462/9284_change-icon-based-on-state-in-commanddata&PID=36785#36785

Best,
-Niklas

On 11/11/2013 at 08:39, xxxxxxxx wrote:

Thanks for Nik.

Has not been able to resolve to me yet, but I will do my best to refer to it.