PDA

View Full Version : create instance of an defined class / webcam



gigo
January 3, 2007, 12:22:39
hi, i build a small class

namespace webcam
{
class IP_cam
{
private MVSmartControl.IMVSCFilterGraph m_FilterGraph;
private AxMVSmartControl.AxMVSmartControl axMVSmartControl;
private string AppConfigPath = @"C:\PROJEKTE\motioncam_new\rohdaten\simple_view.mvp";

public Control DrawControl(System.ComponentModel.ComponentResourc eManager resources)
{
this.axMVSmartControl = new AxMVSmartControl.AxMVSmartControl();
((System.ComponentModel.ISupportInitialize)(this.a xMVSmartControl)).BeginInit();
this.axMVSmartControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Win dows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.axMVSmartControl.Location = new System.Drawing.Point(320, 1);
this.axMVSmartControl.Name = "axMVSmartControl";
this.axMVSmartControl.OcxState = ((System.Windows.Forms.AxHost.State)(resources.Get Object("axMVSmartControl.OcxState")));
this.axMVSmartControl.Size = new System.Drawing.Size(320, 240);
this.axMVSmartControl.TabIndex = 0;
((System.ComponentModel.ISupportInitialize)(this.a xMVSmartControl)).EndInit();
return axMVSmartControl;
}

public void LoadConfig()
{
this.m_FilterGraph = (MVSmartControl.IMVSCFilterGraph)axMVSmartControl. GetOcx();
this.m_FilterGraph.LoadConfig(this.AppConfigPath);
}

public void Start()
{
this.m_FilterGraph.Start();
}
}
}

my problem is that
when i run this class in my application i get an error this.m_FilterGraph.LoadConfig(this.AppConfigPath); <-- that this is a null reference, but why? when i run this source code in the main apllication it runs.

best regards

enrico hofmann