View Single Post
  #3  
Old November 26th 08, 02:26 PM posted to microsoft.public.outlook.program_addins
Andrew
external usenet poster
 
Posts: 95
Default Custom Image added to CommandBar Buttons

Thanks a lot Ken!

Regards,
Andrew

"Andrew" wrote:

Hello All,

I have an add-in developed in Visual Studio 2008, written in VB.Net for
Outlook 2003 that I'm trying to add a custom image to commandbar buttons that
I created. The image displays correctly in every inspector window except when
I select Microsoft Word as the email editor. When that is selected and I open
a New mail, it throws the following error: "Catastrophic failure (Exception
from HRESULT: 0x8000FFFF (E_UNEXPECTED))"

This is happening on my development machine!

The code to add the custom image was also ported to another project for
Outlook 2007 which works flawlessly.

Here is the class where I get the image and store it in a global variable
which I'm adding to the ".Picture" property of button when its created.

Public Class clsScaryFace
Inherits System.Windows.Forms.AxHost

Public Sub New()
MyBase.New("59EE46BA-677D-4d20-BF10-8D8067CB8B32")
End Sub

Public Sub GetScaryFace()
Dim scaryFaceImage As Bitmap = Nothing
'Dim scaryFaceMask As Bitmap = Nothing
Try
scaryFaceImage = My.Resources.Scaryface.scaryface
If (Exists(scaryFaceImage)) Then
g_imgScaryFace = Convert(scaryFaceImage)
End If

Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
scaryFaceImage = Nothing
End Try
End Sub

Private Function Convert(ByVal Image As System.Drawing.Image) As
stdole.IPictureDisp
Convert = CType(GetIPictureDispFromPicture(Image),
stdole.IPictureDisp)
End Function
End Class

I have no idea why this breaks when WordMail is selected as the editor; any
assistance would be greatly appreciated.

Regards

Ads