HighTechTalks DotNet Forums  

Access to members of a AxHost (OCX) dynamically instantiated.

Dotnet Framework (Interop) microsoft.public.dotnet.framework.interop


Discuss Access to members of a AxHost (OCX) dynamically instantiated. in the Dotnet Framework (Interop) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Alvaro E. Gonzalez V.
 
Posts: n/a

Default Access to members of a AxHost (OCX) dynamically instantiated. - 12-18-2007 , 09:03 AM






Hi,


Please check the following code:
Now, after having ActiveX well... How do to access the ActiveX's members ?

using System;
using System.ComponentModel;
namespace WrapOCX
(

public class AxControl : System.Windows.Forms.AxHost
{
public AxControl(string cLSID): base(cLSID){ }
}

public class AXContainer : System.Windows.Forms.UserControl
{
WrapOCX.AxControl _axControl = null;

String _progID = String.Empty;
public String ProgID
{
get
{
return _progID;
}
set
{
_progID = value;
this.SetActiveX();
}
}

private void SetActiveX()
{
this.Controls.Clear();
this._axControl = null;
Type ty = Type.GetTypeFromProgID(_progID); // eg. OVCt1.OVCt1.1 It's MSOffice(2007)

// Outlook View.
this._axControl = new WrapOCX.AxControl(ty.GUID.ToString());

((ISupportInitialize)(this._axControl)).BeginInit( );

this.SyspendLayout();

this._axControl.Name = "axControl";
this._axControl.TabIndex = 0;
this._axControl.Dock = DockStyle.Fill;
this.Show();
this.Controls.Add(this._axControl);

((ISupportInitialize)(this._axControl)).EndInit();

this.ResumeLayout();
}
}
)

-> Now, after having ActiveX well... How do to access the ActiveX's members ?


Alvaro.

Reply With Quote
Reply




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



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.