If the class has a member variable for the control, you should be able to dynamically create the control without having to make the variable a pointer and using new. For example, you should be able to change your example like this:
// Define:
CNiKnob m_knob;
// Create:
WCHAR pwchLicenseKey[] =
{
0x0069, 0x0065, 0x006E, 0x0070, 0x0070, 0x006D,
0x0062, 0x006B, 0x006E, 0x0069, 0x006F, 0x0061,
0x006C, 0x006E, 0x006B, 0x0065, 0x0062, 0x0064,
0x0065, 0x006D, 0x006A, 0x0066, 0x006B, 0x0063,
0x0068, 0x0062, 0x0064, 0x0065, 0x0066, 0x006B,
0x006F, 0x006B, 0x006D, 0x006F, 0x006B, 0x0066,
0x0066, 0x0066, 0x0066, 0x0070, 0x0063, 0x006A,
0x006E, 0
x006D, 0x0070, 0x006D, 0x0066, 0x0069,
0x0069, 0x006D, 0x0061, 0x006D, 0x006B, 0x006E,
0x0064, 0x006F, 0x006A, 0x006A, 0x0069, 0x0066,
0x006F, 0x006B, 0x0063, 0x0065
};
CComBSTR license(pwchLicenseKey);
m_knob.Create(_T(""), WS_VISIBLE, CRect(10, 10, 200, 200), this, 0, NULL, FALSE, license);
I noticed that you're using the ActiveX wrappers that are automatically generated by Visual C++. Since you have Measurement Studio 6.0, I recommend that you look at the Measurement Studio libraries for Visual C++. These libraries were designed to be used natively in C++ and I think that you will find them to be better to develop with than the automatically generated wrappers.
- Elton