Group:  Microsoft Outlook ยป microsoft.public.outlook.program_addins
Thread: About AxHost

Geek News

About AxHost
Yael 5/30/2007 7:31:01 AM
Hi,
I have a problem, this code don't work in every computer:
I'm using this for display a bitmap in the add-in button:

public class MatarotHost : AxHost
{
public MatarotHost() : base( "02FD5840-C1A3-448E-8310-98611DF58281"){ }
public static stdole.IPictureDisp IPictureDisp(System.Drawing.Image Image)
{
return ((stdole.IPictureDisp)(AxHost.GetIPictureDispFromPicture(Image)));
}


this.toolbarBtn.Style = MsoButtonStyle.msoButtonIconAndCaption;
// set pic to this toolbarBtn
string ns = this.GetType().Namespace;
Assembly CurrentAssembly = this.GetType().Assembly;
System.IO.Stream imgStreamPic =
CurrentAssembly.GetManifestResourceStream(ns+"." + "matarotqm.bmp");
stdole.IPictureDisp Pic =
MatarotHost.IPictureDisp(Image.FromStream(imgStreamPic));
this.toolbarBtnWeb.Picture = Pic;

Why it's not working on every computer???
Thank's,
Yael
Re: About AxHost
"Dmitry Streblechenko" <dmitry[ at ]dimastr.com> 5/30/2007 4:57:19 PM
Does not work as in "an exception is raised"? Or as in "no errors, but
nothing happens"?
Is it running on Outlook 2003 or higher? Outlook 2002 or below do not expose
the CommandBarBurton.Picture property.

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

"Yael" <Yael[ at ]discussions.microsoft.com> wrote in message
news:FC939727-5F66-45B0-B9AF-41510B65066F[ at ]microsoft.com...
[Quoted Text]
> Hi,
> I have a problem, this code don't work in every computer:
> I'm using this for display a bitmap in the add-in button:
>
> public class MatarotHost : AxHost
> {
> public MatarotHost() : base( "02FD5840-C1A3-448E-8310-98611DF58281"){ }
> public static stdole.IPictureDisp IPictureDisp(System.Drawing.Image Image)
> {
> return ((stdole.IPictureDisp)(AxHost.GetIPictureDispFromPicture(Image)));
> }
>
>
> this.toolbarBtn.Style = MsoButtonStyle.msoButtonIconAndCaption;
> // set pic to this toolbarBtn
> string ns = this.GetType().Namespace;
> Assembly CurrentAssembly = this.GetType().Assembly;
> System.IO.Stream imgStreamPic =
> CurrentAssembly.GetManifestResourceStream(ns+"." + "matarotqm.bmp");
> stdole.IPictureDisp Pic =
> MatarotHost.IPictureDisp(Image.FromStream(imgStreamPic));
> this.toolbarBtnWeb.Picture = Pic;
>
> Why it's not working on every computer???
> Thank's,
> Yael


Re: About AxHost
Yael 5/30/2007 5:57:01 PM
Outlook 2003.
in some computer I can see my add-in button bmp, and in one of this computer
I can't see my button add-in with no errors, but
nothing happens - I just not see this button.
Do you have any suggestion ?
This works on the majority of desktops less one computetr.

I think The problem is with this method:
When I'm remaring this method, and set button style add-in just cuption with
no icon, I can see add-in button.

public IPictureDisp GetIPictureDispOfPicture(Image image)
{
return (IPictureDisp)MatarotHost.GetIPictureDispFromPicture(image);
}

And why I don't have this option in AxHost ?
AxHost.GetIPictureDispFromPicture(image);
I have only MatarotHost.GetIPictureDispFromPicture(image);

I tried all these:

// public static new stdole.IPictureDisp
GetIPictureDispFromPicture(System.Drawing.Image image)
// {
// return (stdole.IPictureDisp)MatarotHost.GetIPictureDispFromPicture(image);
// }
// public IPictureDisp GetIPictureDispOfPicture(Image image)
// {
// return (IPictureDisp)MatarotHost.GetIPictureDispFromPicture(image);
// }
// public static stdole.IPictureDisp ImageToIpicture(System.Drawing.Image
image)
// {
// return (stdole.IPictureDisp)MatarotHost.GetIPictureDispFromPicture(image);
// }

Thank you.

"Dmitry Streblechenko" wrote:

[Quoted Text]
> Does not work as in "an exception is raised"? Or as in "no errors, but
> nothing happens"?
> Is it running on Outlook 2003 or higher? Outlook 2002 or below do not expose
> the CommandBarBurton.Picture property.
>
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>
> "Yael" <Yael[ at ]discussions.microsoft.com> wrote in message
> news:FC939727-5F66-45B0-B9AF-41510B65066F[ at ]microsoft.com...
> > Hi,
> > I have a problem, this code don't work in every computer:
> > I'm using this for display a bitmap in the add-in button:
> >
> > public class MatarotHost : AxHost
> > {
> > public MatarotHost() : base( "02FD5840-C1A3-448E-8310-98611DF58281"){ }
> > public static stdole.IPictureDisp IPictureDisp(System.Drawing.Image Image)
> > {
> > return ((stdole.IPictureDisp)(AxHost.GetIPictureDispFromPicture(Image)));
> > }
> >
> >
> > this.toolbarBtn.Style = MsoButtonStyle.msoButtonIconAndCaption;
> > // set pic to this toolbarBtn
> > string ns = this.GetType().Namespace;
> > Assembly CurrentAssembly = this.GetType().Assembly;
> > System.IO.Stream imgStreamPic =
> > CurrentAssembly.GetManifestResourceStream(ns+"." + "matarotqm.bmp");
> > stdole.IPictureDisp Pic =
> > MatarotHost.IPictureDisp(Image.FromStream(imgStreamPic));
> > this.toolbarBtnWeb.Picture = Pic;
> >
> > Why it's not working on every computer???
> > Thank's,
> > Yael
>
>
>
Re: About AxHost
Yael 5/31/2007 1:21:11 PM
Hi,
I funded the problem:
Add-in runing only on computer having a VS.NET
If the Visual Studio is not installed I don't get my com add-in because of
public class MatarotHost : AxHost
Why?
Or if I don't add this class, It's running good.
Thank's,
Yael.

public class MatarotHost : AxHost
{
public MatarotHost() : base( "02FD5840-C1A3-448E-8310-98611DF58281"){ }
public static stdole.IPictureDisp IPictureDisp(System.Drawing.Image Image)
{
return ((stdole.IPictureDisp)(AxHost.GetIPictureDispFromPicture(Image)));
}

"Dmitry Streblechenko" wrote:

[Quoted Text]
> Does not work as in "an exception is raised"? Or as in "no errors, but
> nothing happens"?
> Is it running on Outlook 2003 or higher? Outlook 2002 or below do not expose
> the CommandBarBurton.Picture property.
>
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>
> "Yael" <Yael[ at ]discussions.microsoft.com> wrote in message
> news:FC939727-5F66-45B0-B9AF-41510B65066F[ at ]microsoft.com...
> > Hi,
> > I have a problem, this code don't work in every computer:
> > I'm using this for display a bitmap in the add-in button:
> >
> > public class MatarotHost : AxHost
> > {
> > public MatarotHost() : base( "02FD5840-C1A3-448E-8310-98611DF58281"){ }
> > public static stdole.IPictureDisp IPictureDisp(System.Drawing.Image Image)
> > {
> > return ((stdole.IPictureDisp)(AxHost.GetIPictureDispFromPicture(Image)));
> > }
> >
> >
> > this.toolbarBtn.Style = MsoButtonStyle.msoButtonIconAndCaption;
> > // set pic to this toolbarBtn
> > string ns = this.GetType().Namespace;
> > Assembly CurrentAssembly = this.GetType().Assembly;
> > System.IO.Stream imgStreamPic =
> > CurrentAssembly.GetManifestResourceStream(ns+"." + "matarotqm.bmp");
> > stdole.IPictureDisp Pic =
> > MatarotHost.IPictureDisp(Image.FromStream(imgStreamPic));
> > this.toolbarBtnWeb.Picture = Pic;
> >
> > Why it's not working on every computer???
> > Thank's,
> > Yael
>
>
>
Re: About AxHost
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 5/31/2007 1:25:00 PM
Are you deploying stdole.dll with your code?

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


"Yael" <Yael[ at ]discussions.microsoft.com> wrote in message
news:D26F0F3D-BB28-46A7-838B-A1832936BCB8[ at ]microsoft.com...
[Quoted Text]
> Hi,
> I funded the problem:
> Add-in runing only on computer having a VS.NET
> If the Visual Studio is not installed I don't get my com add-in because of
> public class MatarotHost : AxHost
> Why?
> Or if I don't add this class, It's running good.
> Thank's,
> Yael.
>
> public class MatarotHost : AxHost
> {
> public MatarotHost() : base( "02FD5840-C1A3-448E-8310-98611DF58281"){ }
> public static stdole.IPictureDisp IPictureDisp(System.Drawing.Image Image)
> {
> return ((stdole.IPictureDisp)(AxHost.GetIPictureDispFromPicture(Image)));
> }

Re: About AxHost
Yael 5/31/2007 1:39:02 PM
Yes,
I think this is my problem:
"This code won't even compile, as it will see the MyHost declaration,
thinking it is a constructor, and then realizing it is in a MatarotHost
class declaration, will yield an error.

The GetIPictureDispFromPicture is a protected method, so it is only
exposed internally to classes that derive from AxHost."

How could I Show icon on a commandBarButton?
without this method?
Using vs.net 2003 & outlook 2003
What is derived classs?


"Ken Slovak - [MVP - Outlook]" wrote:

[Quoted Text]
> Are you deploying stdole.dll with your code?
>
> --
> 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
>
>
> "Yael" <Yael[ at ]discussions.microsoft.com> wrote in message
> news:D26F0F3D-BB28-46A7-838B-A1832936BCB8[ at ]microsoft.com...
> > Hi,
> > I funded the problem:
> > Add-in runing only on computer having a VS.NET
> > If the Visual Studio is not installed I don't get my com add-in because of
> > public class MatarotHost : AxHost
> > Why?
> > Or if I don't add this class, It's running good.
> > Thank's,
> > Yael.
> >
> > public class MatarotHost : AxHost
> > {
> > public MatarotHost() : base( "02FD5840-C1A3-448E-8310-98611DF58281"){ }
> > public static stdole.IPictureDisp IPictureDisp(System.Drawing.Image Image)
> > {
> > return ((stdole.IPictureDisp)(AxHost.GetIPictureDispFromPicture(Image)));
> > }
>
>
Re: About AxHost
"Dmitry Streblechenko" <dmitry[ at ]dimastr.com> 5/31/2007 5:20:14 PM
This is really a C++ question, not Outlook.
Try to post in a VS newsgroup.

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

"Yael" <Yael[ at ]discussions.microsoft.com> wrote in message
news:A0A98D91-010B-4057-A240-7ADAAE028C20[ at ]microsoft.com...
[Quoted Text]
> Yes,
> I think this is my problem:
> "This code won't even compile, as it will see the MyHost declaration,
> thinking it is a constructor, and then realizing it is in a MatarotHost
> class declaration, will yield an error.
>
> The GetIPictureDispFromPicture is a protected method, so it is only
> exposed internally to classes that derive from AxHost."
>
> How could I Show icon on a commandBarButton?
> without this method?
> Using vs.net 2003 & outlook 2003
> What is derived classs?
>
>
> "Ken Slovak - [MVP - Outlook]" wrote:
>
>> Are you deploying stdole.dll with your code?
>>
>> --
>> 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
>>
>>
>> "Yael" <Yael[ at ]discussions.microsoft.com> wrote in message
>> news:D26F0F3D-BB28-46A7-838B-A1832936BCB8[ at ]microsoft.com...
>> > Hi,
>> > I funded the problem:
>> > Add-in runing only on computer having a VS.NET
>> > If the Visual Studio is not installed I don't get my com add-in because
>> > of
>> > public class MatarotHost : AxHost
>> > Why?
>> > Or if I don't add this class, It's running good.
>> > Thank's,
>> > Yael.
>> >
>> > public class MatarotHost : AxHost
>> > {
>> > public MatarotHost() : base( "02FD5840-C1A3-448E-8310-98611DF58281"){ }
>> > public static stdole.IPictureDisp IPictureDisp(System.Drawing.Image
>> > Image)
>> > {
>> > return
>> > ((stdole.IPictureDisp)(AxHost.GetIPictureDispFromPicture(Image)));
>> > }
>>
>>


Re: About AxHost
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 6/1/2007 1:19:55 PM
I don't know. I've never had a problem with using AxHost in my code and
deploying to computers where VS was never installed. I do use a different
GUID than you're using, I have no idea if that makes any difference.

I agree with Dmitry, at this point it's a .NET/Interop problem and nothing
to do with Outlook. You might have more luck in a general .NET group for C#
where there may be people more knowledgeable about AxHost and its ins and
outs.

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


"Yael" <Yael[ at ]discussions.microsoft.com> wrote in message
news:A0A98D91-010B-4057-A240-7ADAAE028C20[ at ]microsoft.com...
[Quoted Text]
> Yes,
> I think this is my problem:
> "This code won't even compile, as it will see the MyHost declaration,
> thinking it is a constructor, and then realizing it is in a MatarotHost
> class declaration, will yield an error.
>
> The GetIPictureDispFromPicture is a protected method, so it is only
> exposed internally to classes that derive from AxHost."
>
> How could I Show icon on a commandBarButton?
> without this method?
> Using vs.net 2003 & outlook 2003
> What is derived classs?

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net