Click to See Complete Forum and Search --> : sdtole in c#


Dasmo
November 15th, 2005, 02:18 PM
I'm writting an application that embed's word in it's self and needs to copy some of word's toolbar items into custom context menus that support pictures.

To do this i'm iterating though words command bar control objects picking out the command bar controls i want and wrapping them in my own class. When trying to get the ole picture object for the command bar controls an exception is thrown, any idea why??

The following is my cod for dealing with command bar buttons...

CommandBarControl wControl... //Assigned higher in code
ButtonTool bTool = new ButtonTool(); //The wrapper class

//Properties of bTool are set
...
...

//Exception is thrown here.
stdole.IPictureDisp stdolePicture = ((CommandBarButton)wControl).Picture;

//Would convert to image here but is never reached
bTool.Image = ConvertToImage(stdolePicture );

Any help would be appreciated