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

Button throws error when image is added if there's no popup object



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old January 29th 09, 05:08 PM posted to microsoft.public.outlook.program_addins
Andrew
external usenet poster
 
Posts: 95
Default Button throws error when image is added if there's no popup object

Hello All,

I have an Add-in developed for Outlook 2003. Before this change I was adding
an image to the ".Picture" property of the button after initially adding the
button to a popup object. Everything worked fine, however, I decided the
popup object wasn't needed when there was only one associated for a toolbar.
The buttons where I removed the popup object throws following error when its
been created:
"
Error HRESULT E_FAIL has been returned from a call to a COM component".

the other buttons that have a popup, work fine. The image being added is
the same everywhere.

This is the class where I create and assign the image to a global variable:

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
'scaryFaceMask = My.Resources.Scaryface.scary_mask

If (Exists(scaryFaceImage)) Then
g_imgScaryFace = Convert(scaryFaceImage)
'g_imgScaryFaceMask = Convert(scaryFaceMask)
End If

Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
scaryFaceImage = Nothing
'scaryFaceMask = 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

This is where I add the button:
m_butOldEmailSyncToCS =
CType(m_OldEmailCSToolBar.Controls.Add(MsoControlT ype.msoControlButton, , , ,
Temporary:=True), Office.CommandBarButton)

This is where I set the properties after which it blows up when attempting
to assign the g_imgScaryFace

With m_butOldEmailSyncToCS
.Caption = "Save to CS"
.Visible = True
.Enabled = True
.Style = Microsoft.Office.Core.MsoButtonStyle.msoButtonIcon AndCaption
.Picture = g_imgScaryFace
End With

Anyone has any ideas what's going wrong?

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
Custom Image added to CommandBar Buttons Andrew Add-ins for Outlook 2 November 26th 08 03:26 PM
Redemption Pickfolder at offline throws an error Bert_Bert[_2_] Add-ins for Outlook 2 October 29th 08 10:21 PM
Outlook 2007 throws constant Error - please HELP Snig Outlook - Installation 0 May 14th 07 03:04 PM
Image added in Signature shows as attachment Sivakumar Outlook - Using Forms 0 October 4th 06 07:40 AM
Help Add button Popup Robert Outlook and VBA 7 February 17th 06 04:16 PM


All times are GMT +1. The time now is 08:56 PM.


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.