icon in outlook addin commandbar..

J

Joe

hi

i am facing a serious problem with my icons in my Outlook Shared-Addin
which i created using Visual Studio 2005 [c#] . i not able to use files
of *.ico format for the purpose. The one's which are acceptable in the
methods which i came accross take only *.bmp .

i ve used 2 of the following methods both give the same output..
Method 1.

Bitmap bmp;
bmp = (Bitmap)rm.GetObject("calendarIcon");
System.Drawing.Color colorTransparent = bmp.GetPixel(0,
0);
for (int x = bmp.Width - 1; x >= 0; x--)
for (int y = bmp.Height - 1; y >= 0; y--)
if (bmp.GetPixel(x, y) == colorTransparent)
bmp.SetPixel(x, y,
System.Drawing.Color.FromKnownColor(System.Drawing.KnownColor.Control));

Clipboard.SetDataObject(bmp);
ipolipoButton.FaceId = 0;
ipolipoButton.PasteFace();
Method 2.
iPolipoCalendar frmCalendar = new iPolipoCalendar();
ipolipoButton.Picture =
(IPictureDisp)AxHost2.GetIPictureDispFromPicture(frmCalendar.iconList.Images[0]);
~~~~~~~~
public class AxHost2 : AxHost
{
public AxHost2()
: base("59EE46BA-677D-4d20-BF10-8D8067CB8B33")
{
}
public new static IPictureDisp GetIPictureDispFromPicture(Image
image)
{
return
(IPictureDisp)AxHost.GetIPictureDispFromPicture(image);
}
}
~~~~~~~~~~~~~~
both these methods fail to give a trasparent effect to the icons in my
commadbar..
method 1 . works fine for outlook xp as its backcolor is Color.Control.
but the same displays a shadow when it comes to Outlook 2003.

then again.. in the Method 2 *.ico files are not accepted.. only Image
is the acceptable type..

How do i do this .. i ve seen addin with perfect icons like
"GotoMeeting" etc.

could some of the Outlook experts help me out.. is there anyother way
to get it done..

thanks in advance.
 
K

Ken Slovak - [MVP - Outlook]

The requirement for an icon is usually a BMP, although if you can convert
your icon to a BMP you can use that. You also have a limited resolution and
palette you can use.

If you can use Mask and Picture, which actually take an IPictureDisp object,
you are best off. That way you don't step all over the clipboard as
PasteFace does. Of course that limits you to Outlook 2002 or later.

See these articles for more information:

http://support.microsoft.com/?kbid=260850

http://support.microsoft.com/?kbid=286460
 
J

Joe

hey ken thanks a lot for your reply.. it works superb now.

i used the mask and the picture properties..

ResourceManager rm = new
ResourceManager("IpolipoCPlugIn.Properties.Resources",
Assembly.GetExecutingAssembly());

Bitmap bmp;
bmp = (Bitmap)rm.GetObject("calendarIcon");
ipolipoButton.Picture =
(IPictureDisp)AxHost2.GetIPictureDispFromPicture(bmp);
bmp = (Bitmap)rm.GetObject("calendarMask");
ipolipoButton.Mask =
(IPictureDisp)AxHost2.GetIPictureDispFromPicture(bmp);

..... and the code goes on....
so far so good.. it works great in my development machine and in
Outlook 2003 machines .. but when it comes to other fresh Outlook 2002
machine where ther is no Visual Studio or anyting.. It fires the
OnConnect() method and it loads the add-in but it fails to display the
addin becos of the
"(IPictureDisp)AxHost2.GetIPictureDispFromPicture(bmp);" .... how do i
manage this for the Outlook 2002 machines.. ?? the clipborad Copyface
method works fine for all the versions...

please share ur expertise...

thanz in advance..


The requirement for an icon is usually a BMP, although if you can convert
your icon to a BMP you can use that. You also have a limited resolution and
palette you can use.

If you can use Mask and Picture, which actually take an IPictureDisp object,
you are best off. That way you don't step all over the clipboard as
PasteFace does. Of course that limits you to Outlook 2002 or later.

See these articles for more information:

http://support.microsoft.com/?kbid=260850

http://support.microsoft.com/?kbid=286460




Joe said:
hi

i am facing a serious problem with my icons in my Outlook Shared-Addin
which i created using Visual Studio 2005 [c#] . i not able to use files
of *.ico format for the purpose. The one's which are acceptable in the
methods which i came accross take only *.bmp .

i ve used 2 of the following methods both give the same output..
Method 1.

Bitmap bmp;
bmp = (Bitmap)rm.GetObject("calendarIcon");
System.Drawing.Color colorTransparent = bmp.GetPixel(0,
0);
for (int x = bmp.Width - 1; x >= 0; x--)
for (int y = bmp.Height - 1; y >= 0; y--)
if (bmp.GetPixel(x, y) == colorTransparent)
bmp.SetPixel(x, y,
System.Drawing.Color.FromKnownColor(System.Drawing.KnownColor.Control));

Clipboard.SetDataObject(bmp);
ipolipoButton.FaceId = 0;
ipolipoButton.PasteFace();
Method 2.
iPolipoCalendar frmCalendar = new iPolipoCalendar();
ipolipoButton.Picture =
(IPictureDisp)AxHost2.GetIPictureDispFromPicture(frmCalendar.iconList.Images[0]);
~~~~~~~~
public class AxHost2 : AxHost
{
public AxHost2()
: base("59EE46BA-677D-4d20-BF10-8D8067CB8B33")
{
}
public new static IPictureDisp GetIPictureDispFromPicture(Image
image)
{
return
(IPictureDisp)AxHost.GetIPictureDispFromPicture(image);
}
}
~~~~~~~~~~~~~~
both these methods fail to give a trasparent effect to the icons in my
commadbar..
method 1 . works fine for outlook xp as its backcolor is Color.Control.
but the same displays a shadow when it comes to Outlook 2003.

then again.. in the Method 2 *.ico files are not accepted.. only Image
is the acceptable type..

How do i do this .. i ve seen addin with perfect icons like
"GotoMeeting" etc.

could some of the Outlook experts help me out.. is there anyother way
to get it done..

thanks in advance.
 
K

Ken Slovak - [MVP - Outlook]

If it doesn't work on a deployment machine the usual suspects are not having
the PIA's installed, no making sure all prerequisites installed, wrong
version of the framework, security. What exception is thrown when you try to
access AxHost on the Outlook 2002 machine?
 
J

Joe

AxHost doesn't throw any error in my case .. simply that it doesn't
load display the addin.. The addin loads at Outlook startup but fails
to display due to this..
we i remove the AxHost method and use other methods its working fine..

i m using a com addin shim to make it a managed addin... and the right
version of framework is installed in the client machine.. since i m
using shim i dont need to be worried about the pia's at the client
side..

wat could be done ??



If it doesn't work on a deployment machine the usual suspects are not having
the PIA's installed, no making sure all prerequisites installed, wrong
version of the framework, security. What exception is thrown when you try to
access AxHost on the Outlook 2002 machine?

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

Joe said:
hey ken thanks a lot for your reply.. it works superb now.
i used the mask and the picture properties..
ResourceManager rm = new
ResourceManager("IpolipoCPlugIn.Properties.Resources",
Assembly.GetExecutingAssembly());
Bitmap bmp;
bmp = (Bitmap)rm.GetObject("calendarIcon");
ipolipoButton.Picture =
(IPictureDisp)AxHost2.GetIPictureDispFromPicture(bmp);
bmp = (Bitmap)rm.GetObject("calendarMask");
ipolipoButton.Mask =
(IPictureDisp)AxHost2.GetIPictureDispFromPicture(bmp);
.... and the code goes on....
so far so good.. it works great in my development machine and in
Outlook 2003 machines .. but when it comes to other fresh Outlook 2002
machine where ther is no Visual Studio or anyting.. It fires the
OnConnect() method and it loads the add-in but it fails to display the
addin becos of the
"(IPictureDisp)AxHost2.GetIPictureDispFromPicture(bmp);" .... how do i
manage this for the Outlook 2002 machines.. ?? the clipborad Copyface
method works fine for all the versions...
please share ur expertise...
thanz in advance..
 
K

Ken Slovak - [MVP - Outlook]

I don't know that you don't have to worry about PIA's with a shimmed addin
and you might have to worry about other things such as Extensibility.DLL
(required) as well as any other references that need to be deployed. You
should review the material about .NET coding at
http://www.microeye.com/resources/res_outlookvsnet.htm as well as the
walkthroughs at MSDN.
 
J

Joe

i had solved all the issues of the pia's and it is working in all the
client machines.. so my problem is not while deploying the add-in.. i
ve gone thru the link u ve given me.. thanks... but my problem is only
with display of addins in my Outlook xp machines.. has it to do
anything with the mscorlib or something..

its working in my development machine which is outlook xp.. but not in
any fresh machine...

please do reply...

~~~~~~~~~~

I don't know that you don't have to worry about PIA's with a shimmed addin
and you might have to worry about other things such as Extensibility.DLL
(required) as well as any other references that need to be deployed. You
should review the material about .NET coding athttp://www.microeye.com/resources/res_outlookvsnet.htmas well as the
walkthroughs at MSDN.

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

Joe said:
AxHost doesn't throw any error in my case .. simply that it doesn't
load display the addin.. The addin loads at Outlook startup but fails
to display due to this..
we i remove the AxHost method and use other methods its working fine..
i m using a com addin shim to make it a managed addin... and the right
version of framework is installed in the client machine.. since i m
using shim i dont need to be worried about the pia's at the client
side..
wat could be done ??
 
K

Ken Slovak - [MVP - Outlook]

mscorlib is the general loader for .NET COM addins, so it's hard to say what
could be wrong. Usually it's security, lack of needed PIAs (I know you say
you have those), lack of Extensibility.dll (which is not included for
versions of Outlook before Outlook 2007 and must be deployed by you). It's
also possible you might need a strong name and signing of your assemblies,
manifest settings to make sure that the correct version of the framework is
loaded, http://support.microsoft.com/kb/908002 and the registry lockdown
fix.
 
J

Joe

hey ken

in my case everything worked fine until i introduced the code which
Uses "Axhost" for IPictureDisplay .. I am using kb/908002 and also the
strong named the assembly ..
i was not using Extensibility.dll with the deployment setup.. now i
added it and am giving GAC in the client machine as target. still not
seeing any hope !!

now i ve found that it doesnot load in any machines except those that
have Visual Studio.. not even in Outlook 2003... i had tested
previously only machines where Visual Studio was previously installed..


Can i get some sample code where picture and mask property is used..
[c#] its very urgent. with out transparent icons the addin looks so
sick..

thanks in advance..
 
K

Ken Slovak - [MVP - Outlook]

There are a number of samples using C# at www.outlookcode.com. Look for the
Inspector and Explorer wrapper examples by Helmut Obertanner. I can tell you
though that he uses AxHost, just as I do in my code when I'm doing .NET and
need to add icons to buttons.

If deployment only works on machines where VS 2005 is installed then some
DLL that gets installed isn't there on the other machines. It's hard for me
to say what that is, but in the past I've had to distribute to the GAC:
Extensibility.dll, Outlook.dll, word.dll, vbe.interop.dll, office.dll,
visualbasic.compatibility.dll, stdole.dll.
 
J

Joe

hey thanks a lot Ken

The issue is SOLVED ... :)

the problem was due to a the missing dll. i had not included stdole.dll
in my setup project.
once its done .. all is fine .. :) and i m a happy man today :)

thanks for ur generous reply n support..

Joe Augustine
Compassites Software Solutions
Bangalore
India
 
K

Ken Slovak - [MVP - Outlook]

Good, I'm glad.

So stdole.dll was the problem?

I've found that any of the COM references I use in my .NET code have to be
checked against a clean virtual machine to make sure that the references are
in the GAC or that I need to deploy them myself.
 
J

Joe

ya very true !!!

in typical development environments its so hard to get a 'clean'
virtual machine.. bcoz of which we end up wasting our time struggling
to find out wat exactly is wrong.. in my case it was stdole.dll...
any way nice talking to you .. thanks ..

regards

Joe .
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top