A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Custom Image added to CommandBar Buttons



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 25th 08, 10:29 PM posted to microsoft.public.outlook.program_addins
Andrew
external usenet poster
 
Posts: 95
Default Custom Image added to CommandBar Buttons

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
  #2  
Old November 25th 08, 11:54 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Custom Image added to CommandBar Buttons

..Picture and .Mask take IPictureDisp objects, which cannot be passed across
process boundaries. WordMail 2003 is a subclassed word.exe and so is running
in another process space. You must use .PasteFace for WordMail 2003 button
images. Put the image on the clipboard and .PasteFace will take it from
there.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Andrew" wrote in message
news
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


  #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

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Add custom icon to commandbar button Dhananjay Outlook and VBA 1 October 24th 07 09:58 PM
Adding image to Outlook commandbar button saturn Add-ins for Outlook 3 August 3rd 07 02:13 PM
Enable/Disable Commandbar buttons Bodo Add-ins for Outlook 3 July 12th 07 02:14 PM
Custom Commandbar doesn't appear when opening or creating a new email Karsten_Markmann Outlook and VBA 2 July 19th 06 06:26 AM
Custom CommandBar in Wordmail Editor. Sanjay Add-ins for Outlook 0 May 31st 06 10:11 PM


All times are GMT +1. The time now is 09:18 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.