none
Classes that derive RRS feed

  • Question

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

     

    How to write classes that derive from AxHost??

    please I don't understand..


    this is not classs derive from axHost?

    public class MatarotHost : AxHost

     {
     public MyHost() : base("02FD5840-C1A3-448E-8310-98611DF58281"){ }
     public IPictureDisp GetIPicture(Image image)

      {
       return (IPictureDisp)MatarotHost .GetIPictureDispFromPicture(image);

      }
     }

    Thank's

    Thursday, May 31, 2007 1:31 PM

Answers

  • I am not familiar enough with what you want to do to give you that answer. I am only showing you why calling the function as you did, does not work.

    I surmise that AxHost has it protected for a reason...most likely due to state issues in loading or accessing internal resources, that your blind call to it does not answer and would generate an exception if it was made public...you must work with AxHost in the way it was designed or find a different class.

    As to base that is a C# keyword that says from a derived class I want to access my base members. Its counterpart is the this keyword.
    Thursday, May 31, 2007 4:37 PM

All replies

  • The snippet you provided the GetPicture is trying to access as a protected static base method on another static instance that happens to be the base class of this object in question... which is still a no-no.

    Only in the context of MatarotHost instance can one access the base's protected function such as this

    return (iPidtureDisp) base.GetPictureDispFromPicture(image).

    Read up more on the protected keyword in C# which gives another example.
    Thursday, May 31, 2007 4:04 PM
  • Thank you,

    I don't have in base nothing..Could you tell me please how I need to write this method?

    public class MatarotHost : AxHost

     {
     public MyHost() : base("02FD5840-C1A3-448E-8310-98611DF58281"){ }
     public IPictureDisp GetIPicture(Image image)

      {
       return (IPictureDisp)MatarotHost .GetIPictureDispFromPicture(image);

      }
     }

    I can't find examples of this ( with base.GetIPictureDispFromPicture(image)Wink

    Thursday, May 31, 2007 4:27 PM
  • I am not familiar enough with what you want to do to give you that answer. I am only showing you why calling the function as you did, does not work.

    I surmise that AxHost has it protected for a reason...most likely due to state issues in loading or accessing internal resources, that your blind call to it does not answer and would generate an exception if it was made public...you must work with AxHost in the way it was designed or find a different class.

    As to base that is a C# keyword that says from a derived class I want to access my base members. Its counterpart is the this keyword.
    Thursday, May 31, 2007 4:37 PM
  • I created a com add-in for outlook 2003 in vs.net 2003 c#.

    My problem is with return type stdole.IPictureDisp.

    if I calling

    stdole.IPictureDisp Pic = MatarotHost.ImageToIPicture(Image.FromStream(imgStreamPic));

    And I don't have a vs.net installed in a computer:

    I don't get errors, but I can't see the button add-in

    The add-in not arrive to this part of the code

    OnStartupComplete()  

    else - everything running OK!

    Thanking you in anticipation

    Yael

    Wednesday, June 6, 2007 7:33 AM