![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
I try very think in this topic but i still can't get it working. I
don;t want to use the copy and paste because the user will loss there clipboard and if you try so save it, it could be 300mb as explain above. So could some one who got it working post there code up. The code i have is: Dim path As String = "C:\Visual Studio Projects\DC\DMCRM\icons\AddTelephoneCall.ico" Dim imgconv As ImageConverter Dim img As System.Drawing.Image img = System.Drawing.Image.FromFile(path) Dim a As stdole.IPictureDisp = imgconv.ImageToIPicDisp(img) .Picture = a Public Class ImageConverter Inherits System.Windows.Forms.AxHost Public Sub New(ByVal pGUID As String) MyBase.New(pGUID) End Sub Public Shared Function ImageToIPicDisp(ByVal value As System.Drawing.Image) As stdole.IPictureDisp Return System.Windows.Forms.AxHost.GetIPictureDispFromPic ture(value) End Function Public Shared Function IPicDispToImage(ByVal value As stdole.IPictureDisp) As System.Drawing.Image Return System.Windows.Forms.AxHost.GetPictureFromIPicture Disp(CType(value, Object)) End Function End Class the code get a error on this line ' .Picture = a' any help please Donald |
#2
|
|||
|
|||
![]()
As far as I know, you have to use a bitmap type of image.
(System.Drawing.Bitmap) Not an icon. -- Josh Einstein Einstein Technologies Microsoft Tablet PC MVP Tablet Enhancements for Outlook 2.0 - Try it free for 14 days www.tabletoutlook.com "donald" wrote in message oups.com... I try very think in this topic but i still can't get it working. I don;t want to use the copy and paste because the user will loss there clipboard and if you try so save it, it could be 300mb as explain above. So could some one who got it working post there code up. The code i have is: Dim path As String = "C:\Visual Studio Projects\DC\DMCRM\icons\AddTelephoneCall.ico" Dim imgconv As ImageConverter Dim img As System.Drawing.Image img = System.Drawing.Image.FromFile(path) Dim a As stdole.IPictureDisp = imgconv.ImageToIPicDisp(img) .Picture = a Public Class ImageConverter Inherits System.Windows.Forms.AxHost Public Sub New(ByVal pGUID As String) MyBase.New(pGUID) End Sub Public Shared Function ImageToIPicDisp(ByVal value As System.Drawing.Image) As stdole.IPictureDisp Return System.Windows.Forms.AxHost.GetIPictureDispFromPic ture(value) End Function Public Shared Function IPicDispToImage(ByVal value As stdole.IPictureDisp) As System.Drawing.Image Return System.Windows.Forms.AxHost.GetPictureFromIPicture Disp(CType(value, Object)) End Function End Class the code get a error on this line ' .Picture = a' any help please Donald |
#3
|
|||
|
|||
![]()
this is a bitmap type of image.
I look in to this and i don;t think it is Converting the image to a ImageToIPicDisp in the right way. |
#4
|
|||
|
|||
![]()
just so you know i get this error message:
System.Runtime.InteropServices.COMException (0x80004005): Unspecified error at Microsoft.Office.Core._CommandBarButton.set_Pictur e(IPictureDisp ppdispPicture) at DC.Connect.createBar() in C:\Visual Studio Projects\DC\DMCRM\Connect.vb:line 853 line 853 is .Picture = a thanks Donald |
#5
|
|||
|
|||
![]()
I did some research on what you were trying to do. According to a thread I
found at ureader.com. Ken Slovak said that IPictureDisp constraint is that the image must be a 16x16 256 color BMP. Other wise you might get the error that you are experiencing. If I were you I would convert your .ico to a .bmp and try to run the program again. Or, go ahead and add the image to a resource file inside your add-in and use a resource manager to pull the appropriate image out of and then use the IPictureDisp code that you already have to render the image on the commandbar button. It's an idea, for what it's worth Thaddaeus. http://support.microsoft.com/kb/288771 "donald" wrote in message oups.com... I try very think in this topic but i still can't get it working. I don;t want to use the copy and paste because the user will loss there clipboard and if you try so save it, it could be 300mb as explain above. So could some one who got it working post there code up. The code i have is: Dim path As String = "C:\Visual Studio Projects\DC\DMCRM\icons\AddTelephoneCall.ico" Dim imgconv As ImageConverter Dim img As System.Drawing.Image img = System.Drawing.Image.FromFile(path) Dim a As stdole.IPictureDisp = imgconv.ImageToIPicDisp(img) .Picture = a Public Class ImageConverter Inherits System.Windows.Forms.AxHost Public Sub New(ByVal pGUID As String) MyBase.New(pGUID) End Sub Public Shared Function ImageToIPicDisp(ByVal value As System.Drawing.Image) As stdole.IPictureDisp Return System.Windows.Forms.AxHost.GetIPictureDispFromPic ture(value) End Function Public Shared Function IPicDispToImage(ByVal value As stdole.IPictureDisp) As System.Drawing.Image Return System.Windows.Forms.AxHost.GetPictureFromIPicture Disp(CType(value, Object)) End Function End Class the code get a error on this line ' .Picture = a' any help please Donald |
#6
|
|||
|
|||
![]()
Here are a couple of VB style answers to your question and help your
quandry. http://msdn.microsoft.com/library/de...ce05022002.asp http://support.microsoft.com/?scid=k...d=2488&sid=251 Regards Thaddaeus. "Thaddaeus Parker" wrote in message ... I did some research on what you were trying to do. According to a thread I found at ureader.com. Ken Slovak said that IPictureDisp constraint is that the image must be a 16x16 256 color BMP. Other wise you might get the error that you are experiencing. If I were you I would convert your .ico to a .bmp and try to run the program again. Or, go ahead and add the image to a resource file inside your add-in and use a resource manager to pull the appropriate image out of and then use the IPictureDisp code that you already have to render the image on the commandbar button. It's an idea, for what it's worth Thaddaeus. http://support.microsoft.com/kb/288771 "donald" wrote in message oups.com... I try very think in this topic but i still can't get it working. I don;t want to use the copy and paste because the user will loss there clipboard and if you try so save it, it could be 300mb as explain above. So could some one who got it working post there code up. The code i have is: Dim path As String = "C:\Visual Studio Projects\DC\DMCRM\icons\AddTelephoneCall.ico" Dim imgconv As ImageConverter Dim img As System.Drawing.Image img = System.Drawing.Image.FromFile(path) Dim a As stdole.IPictureDisp = imgconv.ImageToIPicDisp(img) .Picture = a Public Class ImageConverter Inherits System.Windows.Forms.AxHost Public Sub New(ByVal pGUID As String) MyBase.New(pGUID) End Sub Public Shared Function ImageToIPicDisp(ByVal value As System.Drawing.Image) As stdole.IPictureDisp Return System.Windows.Forms.AxHost.GetIPictureDispFromPic ture(value) End Function Public Shared Function IPicDispToImage(ByVal value As stdole.IPictureDisp) As System.Drawing.Image Return System.Windows.Forms.AxHost.GetPictureFromIPicture Disp(CType(value, Object)) End Function End Class the code get a error on this line ' .Picture = a' any help please Donald |
#7
|
|||
|
|||
![]()
Hi there,
thanks for your reply's but i try it as a 256 color 16x16 bitmap and no luck at all. As for the 2 web link they both use LoadPicture which is not available in vb.net i am using vb.net 2003 with office outlook 2003 thanks Donald |
#8
|
|||
|
|||
![]()
I am at a loss for your problem. I wish that I could give you a more
definitive answer to your problem. Thaddaeus. "donald" wrote in message oups.com... Hi there, thanks for your reply's but i try it as a 256 color 16x16 bitmap and no luck at all. As for the 2 web link they both use LoadPicture which is not available in vb.net i am using vb.net 2003 with office outlook 2003 thanks Donald |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
custom menu command | Melissa m | Outlook - Using Contacts | 1 | February 27th 06 08:27 PM |
Custom icon superseded by tracking icon | Vaughan | Outlook - Using Forms | 4 | February 24th 06 01:47 PM |
Outlook Shutdown - command line | Pete | Outlook - Installation | 1 | February 7th 06 09:28 PM |
Outlook command-line switches | Brad Nowlin | Outlook - General Queries | 1 | January 27th 06 06:00 PM |
Command button not working on read page | jbtempe | Outlook - Using Forms | 2 | January 14th 06 12:25 AM |