Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Why do I get a MissingManifestResourceException when I try to use an MFC Control Wrapper in a Windows Forms Project with Measurement Studio 7.0?

I can use the .NET Windows Forms Controls without problems, but when I try to add an MFC control, everything appears to work fine until runtime. The program throws the aforementioned exception claiming that the resources haven't been added to the compiled project. Any help is appreciated. Thanks.

Victor
0 Kudos
Message 1 of 6
(4,425 Views)
Can you please clarify what you mean by MFC control? Do you mean that you're adding an ActiveX control that was created with MFC? Can you please specify which control you're using to get this error? Thanks.

- Elton
0 Kudos
Message 2 of 6
(4,425 Views)
I attempted to add the CNiGraph3D control to a Windows Forms Project that I've been working on for a few months. The control appears on the form designer and I have access to all the properties. However, when I try to run the program, I receive the aforementioned unhandled exception. Thanks!

Victor
0 Kudos
Message 3 of 6
(4,425 Views)
Ok, I see. Just to clarify, the 3D graph control is actually an ActiveX control. CNiGraph3D is a native C++ interface to this ActiveX control to make it much more natural for C++ users instead of having to deal with the automation types that are used in the wrappers that are automatically generated by MFC. If you're using the 3D graph control in a Windows Forms project, it should be the actual ActiveX control and not CNiGraph3D.

Anyway, I tested this on my machine and was not able to reproduce the exception that you reported. Could you please provide step-by-step directions, starting at the point that you create the project, that demonstrate how to reproduce this error? Also, which version of Measurement Studio and which version of Visua
l Studio .NET are you using? Thanks.

- Elton
0 Kudos
Message 4 of 6
(4,425 Views)
I didn't see any 3D Graph Control that I could use from the .NET controls installed with measurement studio. The only way I can get a 3D Graph control on my project is by wrapping the ActiveX control, correct? This however presents other problems like how to instantiate data type objects (like CNiReal64Vector) in my Windows Forms project. Any ideas?
0 Kudos
Message 5 of 6
(4,425 Views)
That is correct that you will need to create an interop wrapper for the 3D graph ActiveX control if you want to use the 3D graph in a Windows Forms project. However, data types like CNiReal64Vector are only in the C++ interfaces and are not in the ActiveX interface, hence you can use normal .NET data types and will not need to create the C++ data types. The interop wrapper will convert the .NET data types to the expected ActiveX data types and will pass those data types on to the ActiveX control. For example, here is a C# example that demonstrates how to plot a dual sine surface on the interop wrapper of the 3D graph:

const int size = 40;
double[] xData = new double[size];
double[] yData = new double[size];
double[,] z
Data = new double[size, size];

for (int i = 0; i < size; ++i)
xData[i] = yData[i] = ((i - 20.0) / 20.0) * Math.PI;

for (int i = 0; i < size; ++i)
{
for (int j = 0; j < size; ++j)
zData[j, i] = Math.Sin(xData[i]) * Math.Cos(yData[j]) + 2.0;
}

graph3D.Plot3DSurface(xData, yData, zData, Type.Missing);

- Elton
0 Kudos
Message 6 of 6
(4,425 Views)