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

Command bar button FaceID Icon



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 8th 06, 04:11 PM posted to microsoft.public.outlook.program_addins
donald
external usenet poster
 
Posts: 25
Default Command bar button FaceID Icon

i going this in outlook 2003

trying with this code in a COM add-in for outlook 2003 but it doesn't
work becuase it doesn't find the command LoadPicture.

Any help please

Donald

Sub DisplayNewImage( )
Dim cbar As CommandBar
Dim cbarctrl As CommandBarControl
Dim pImage As IPictureDisp
Dim pMask As IPictureDisp
Dim sImageFile as String
Dim sMaskFile as String

sImageFile = "C:\Documents and Settings\My Documents\tarsier.bmp"
sMaskFile = "C:\Documents and Settings\My Documents\mask.bmp"

Set cbar = CommandBars.Add(Name:="My Picture",
Position:=msoBarFloating)

Set cbarctrl = cbar.Controls.Add(Type:=msoControlButton)
Set pImage = stdole.StdFunctions.LoadPicture(sImageFile)
Set pMask = stdole.StdFunctions.LoadPicture(sMaskFile)

cbarctrl.Picture = pImage
cbarctrl.Mask = pMask

cbar.visible = True

End Sub

  #2  
Old February 8th 06, 06:27 PM posted to microsoft.public.outlook.program_addins
Thaddaeus Parker
external usenet poster
 
Posts: 17
Default Command bar button FaceID Icon

What it looks like you are trying to do is load the picture from the
clipboard. If the picture and mask are not in the clipboard you cannot get
them out of the clipboard.

Here is my code that does what you are trying to do.
using stdole
/// summary

/// AxHost2 is a derivative of AxHost for getting IPictureDisp from a .NET
image type

/// /summary

internal class AxHost2 : AxHost

{

public AxHost2() : base(null)

{}

new public static IPictureDisp GetIPictureDispFromPicture(Image image)

{

return (IPictureDisp) AxHost.GetIPictureDispFromPicture(image);

}

}

public static void AssignButtonImageAndMask(ref CommandBarButton button,
string imageName, string imageMask)

{

//adds a custom icon to the face

ResourceManager rm = new ResourceManager(typeof(OutlookUtilities).Namespace
+ ResourceImageFileName typeof(OutlookUtilities).Assembly);

using (Bitmap bmp = (Bitmap) rm.GetObject(imageName))

{

if (bmp != null)

{

button.Picture = AxHost2.GetIPictureDispFromPicture(bmp);

}

}

using (Bitmap bmp = (Bitmap) rm.GetObject(imageMask))

{

if (bmp != null)

{

button.Mask = AxHost2.GetIPictureDispFromPicture(bmp);

}

}

}

That bit of code should help you along.



Regards,

Thaddaeus.

"donald" wrote in message
oups.com...
i going this in outlook 2003

trying with this code in a COM add-in for outlook 2003 but it doesn't
work becuase it doesn't find the command LoadPicture.

Any help please

Donald

Sub DisplayNewImage( )
Dim cbar As CommandBar
Dim cbarctrl As CommandBarControl
Dim pImage As IPictureDisp
Dim pMask As IPictureDisp
Dim sImageFile as String
Dim sMaskFile as String

sImageFile = "C:\Documents and Settings\My Documents\tarsier.bmp"
sMaskFile = "C:\Documents and Settings\My Documents\mask.bmp"

Set cbar = CommandBars.Add(Name:="My Picture",
Position:=msoBarFloating)

Set cbarctrl = cbar.Controls.Add(Type:=msoControlButton)
Set pImage = stdole.StdFunctions.LoadPicture(sImageFile)
Set pMask = stdole.StdFunctions.LoadPicture(sMaskFile)

cbarctrl.Picture = pImage
cbarctrl.Mask = pMask

cbar.visible = True

End Sub



  #3  
Old February 8th 06, 07:48 PM posted to microsoft.public.outlook.program_addins
donald
external usenet poster
 
Posts: 25
Default Command bar button FaceID Icon

hi there,

I don't want to do it with copy and paste i am using Outlook 2003.

I want to do it using .picture and .mask.

Any help please

Donald

  #4  
Old February 8th 06, 08:03 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Command bar button FaceID Icon

See if this helps: http://support.microsoft.com/?kbid=286460

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"donald" wrote in message
oups.com...
i going this in outlook 2003

trying with this code in a COM add-in for outlook 2003 but it doesn't
work becuase it doesn't find the command LoadPicture.

Any help please

Donald

Sub DisplayNewImage( )
Dim cbar As CommandBar
Dim cbarctrl As CommandBarControl
Dim pImage As IPictureDisp
Dim pMask As IPictureDisp
Dim sImageFile as String
Dim sMaskFile as String

sImageFile = "C:\Documents and Settings\My Documents\tarsier.bmp"
sMaskFile = "C:\Documents and Settings\My Documents\mask.bmp"

Set cbar = CommandBars.Add(Name:="My Picture",
Position:=msoBarFloating)

Set cbarctrl = cbar.Controls.Add(Type:=msoControlButton)
Set pImage = stdole.StdFunctions.LoadPicture(sImageFile)
Set pMask = stdole.StdFunctions.LoadPicture(sMaskFile)

cbarctrl.Picture = pImage
cbarctrl.Mask = pMask

cbar.visible = True

End Sub


  #5  
Old February 8th 06, 10:44 PM posted to microsoft.public.outlook.program_addins
donald
external usenet poster
 
Posts: 25
Default Command bar button FaceID Icon

i look at that page but i can't do:

Set oPic = LoadPicture(App.Path & "\circle.bmp")

because I can't find 'LoadPicture' in VB.net as my project is a COM
add-in for outlook 2003

thanks again

Donald

  #6  
Old February 9th 06, 12:26 AM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Command bar button FaceID Icon

Because you don't have a reference to the Win32 library where that method
lives or because of http://support.microsoft.com/kb/150034/?
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"donald" wrote in message
oups.com...
i look at that page but i can't do:

Set oPic = LoadPicture(App.Path & "\circle.bmp")

because I can't find 'LoadPicture' in VB.net as my project is a COM
add-in for outlook 2003

thanks again

Donald


  #7  
Old February 9th 06, 12:35 AM posted to microsoft.public.outlook.program_addins
donald
external usenet poster
 
Posts: 25
Default Command bar button FaceID Icon

'LoadPicture' is just not available in vb.net so how do i get round
this?

Donald

  #8  
Old February 9th 06, 03:05 AM posted to microsoft.public.outlook.program_addins
Josh Einstein
external usenet poster
 
Posts: 57
Default Command bar button FaceID Icon

Thaddaeus gave you an example of the only known way to do this in .NET. It's
the only way to get an IPictureDisp from a System.Drawing.Image object. Your
reply to him stated that you didn't want to use Copy/Paste but his example
showed you how to use Picture and Mask, not Copy/Paste.

--
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...
'LoadPicture' is just not available in vb.net so how do i get round
this?

Donald



  #9  
Old February 9th 06, 06:27 AM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Command bar button FaceID Icon

Also note that if you are using the Word editor, PasteFace is your only
option: IPicture object cannot be marshaled across thee process boundaries:
Word inspectors live in the ewinword.exe process space rather than
outlook.exe
Also note that you can save the clipboard contents before copying a bitmap
to the clipboard and restore it afterwards. Babelfish sample COM add-in
source code (url below) has a utility class to do that (Delphi) - see
uSaveClipboard.pas file.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Josh Einstein" wrote in message
...
Thaddaeus gave you an example of the only known way to do this in .NET.
It's the only way to get an IPictureDisp from a System.Drawing.Image
object. Your reply to him stated that you didn't want to use Copy/Paste
but his example showed you how to use Picture and Mask, not Copy/Paste.

--
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...
'LoadPicture' is just not available in vb.net so how do i get round
this?

Donald





 




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 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


All times are GMT +1. The time now is 11:43 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.