Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Debug Assertion failures when calling CCWGPIB functions

I get Debug Assertion failures when calling any of the CCWGPIB functions. Using the CWGPIB Active-X control’s properties I am able to send test strings to my GPIB instrument with no problems. However, when I run the program (compiled for debug) and call any of the CCWGPIB functions I will get a debug assertion failure in any number of CWnd functions. For example, if I call SetBoardNumber(0), it results in the following assertion error:

File - WINOCC.CPP
Method - CWnd::SetProperty()
Failure - ASSERT(m_pCtrlSite != NULL) // not an OLE control (not yet, at least)

My development environment is:
WIN2000
Measurement Studio 6.0
VC++ 6.0

I have built VC++ projects before on a Win98 machine using C
omponent works 2.0 and never encountered this problem. Can anyone help??
0 Kudos
Message 1 of 3
(3,667 Views)
Usually when ASSERT(m_pCtrlSite != NULL) fails it's indicating a problem with the ActiveX control container support. Check to see if you have a call to AfxEnableControlContainer in your code. It's typically added in the InitInstance method of the class in your project that's derived from CWinApp.

If you have Measurement Studio 6.0, though, you should also have the Measurement Studio libraries for Visual C++, which contain native C++ classes that communicate directly with the NI-4882 libraries and eliminate the need for using the MFC wrappers for CCWGPIB in Visual C++. Take a look at the CNi4882Device and CNi4882Board classes in the Measurement Studio reference for more info. You can use the Measurement Studio AppWizard to create new projects that u
se these libraries, or you can use the Measurement Studio Add/Remove Components Wizard to add support for these libraries to existing Visual C++ projects.

- Elton
Message 2 of 3
(3,667 Views)
First I used Add/Remove Components Wizard to add support for 488.2.
Then once I started using the CNi4882Device class everything started working properly.

I really appreciate you taking the time to answer my question.

Thanks
0 Kudos
Message 3 of 3
(3,667 Views)