Jump to content
Software FX Community

Re: AddCommand/VC++ problem

User (Legacy)

Recommended Posts

Good morning! 

I am not sure about the solution to your problem, but here is sample code

that works for me....

ICommandBar *commands;

IToolBar *toolbar;





commands->Item[CFDC_COMMANDZOOM]->Picture = 7;

commands->Item[CFDC_COMMANDZOOM]->Text = "Zoom";

commands->Item[CFDC_COMMANDZOOMONBASE]->Picture = 3;

commands->Item[CFDC_COMMANDZOOMONBASE]->Text = "Zoom On Base Data";

CPictureHolder pPict;

short pictloc;


pictloc = commands->AddPicture((IPictureDisp *)pPict.GetPictureDispatch());

commands->Item[CFDC_ADDTIMEPOINTS]->Style = (CommandItemStyle)CBIS_TWOSTATE;

commands->Item[CFDC_ADDTIMEPOINTS]->Picture = pictloc;

commands->Item[CFDC_ADDTIMEPOINTS]->Text = "Add Time Points";


toolbar->AddItems(3, 11);

toolbar->PutitemCommandID(11, CFDC_COMMANDZOOM);

toolbar->PutitemCommandID(12, CFDC_COMMANDZOOMONBASE);

toolbar->PutitemCommandID(13, CFDC_ADDTIMEPOINTS);

I hope this helps you.



Tim Shearer <tshearer@symmetricom.com> wrote in message


> I'm using ChartFX 98/4.0, can I wish to add a new command(40), with


> text of 'MyPrint' and the 'Printer' icon, at location 10 of the ToolBar.

> Why doesn't this work?????


> m_pChartFX->Commands->AddCommand(40);

> m_pChartFX->ToolBarObj->AddItems(1,10);

> m_pChartFX->Commands->PutitemText( 40, "MyPrint" );

> m_pChartFX->Commands->PutitemPicture( 40, 2 );

> m_pChartFX->ToolBarObj->Item[10]->CommandID = 40;



> This kinda works ... however, the icon displayed in the 10th tool location

> is the Open Folder, and the ToolTip text says 'Solid'. When I click on


> icon, I am taken to the UserCommand command handler function, which is


> I want. But why aren't the icon & ToolTip text changed???


> Can anyone show me working VC++ code, please? I'm very disappointed in


> of C++ type sample code.


> Thanks,

> Tim




Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...