Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

axcwdaqcontrolslib vs cwdaqcontrolslib

Hello,
I am trying to find out the difference between axcwdaqcontrolslib  and cwdaqcontrolslib. Thanks for any help. randy
0 Kudos
Message 1 of 6
(6,753 Views)
Hi Randy,

I am assuming you are trying to using the Traditional DAQ ActiveX Control (CWDaqTools) in the .NET environment. You probably dragged the CWDaqTools Control onto a Windows Form and noticed that two new references (AxCWDAQControlsLib and CWDAQControlsLib) where added to your project.

This concept revolves around trying to use ActiveX components in the .NET Framework. Because Windows Forms can host only Windows Forms controls, Visual Studio .NET automatically creates Windows Forms wrappers for ActiveX controls so you can continue to use them in Visual Studio .NET projects.  At a high-level view, the AxCWDAQControlsLib is the Windows Form proxy assembly for the ActiveX control and the CWDAQControlsLib is the assembly that contains a CLR proxy for the ActiveX control.

Check out the section entitled "Windows Forms and ActiveX Controls" in the Using Measurement Studio ActiveX Controls in Visual Studio .NET tutorial. This explains in more detail about what each .NET wrapper entails.

Personally, when working with COM and .NET, I like to refer to the Using ActiveX Controls with Windows Forms in Visual Studio .NET Microsoft tutorial. Also, the Integrating COM with .NET article is pretty decent.

Hope this helps!

Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 2 of 6
(6,746 Views)

Hi Jonathan,

 

I am not sure you are still available since the post was two years old. I had a problem to use AxCWDAQControlsLib with CWCounter. I have error when I called Configure() function as below:

 

System.Runtime.InteropServices.COMException was unhandled
  ErrorCode=-2146817829
  HelpLink="cwdaq.chm#500"
  Message="Configuring channels  The NI-DAQ DLL could not be called due to an interface error."
  Source="cwdaq"
  StackTrace:
       at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)    at CWDAQControlsLib._DCWCounter.Configure()    at AxCWDAQControlsLib.AxCWCounter.Configure()    at USB6501App.Form1.statusButton_Click(Object sender, EventArgs e) in D:\Fisheye_Project_2008\USB6501App\USB6501App\Form1.vb:line 71    at System.Windows.Forms.Control.OnClick(EventArgs e)    at System.Windows.Forms.Button.OnClick(EventArgs e)    at System.Windows.Forms.Button.WndProc(Message& m)    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)    at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)    at System.Windows.Forms.UnsafeNativeMethods.SendMessage(HandleRef hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)    at System.Windows.Forms.Control.SendMessage(Int32 msg, IntPtr wparam, IntPtr lparam)    at System.Windows.Forms.Control.ReflectMessageInternal(IntPtr hWnd, Message& m)    at System.Windows.Forms.Control.WmCommand(Message& m)    at System.Windows.Forms.Control.WndProc(Message& m)    at System.Windows.Forms.ScrollableControl.WndProc(Message& m)    at System.Windows.Forms.ContainerControl.WndProc(Message& m)    at System.Windows.Forms.Form.WndProc(Message& m)    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)    at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)    at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)    at System.Windows.Forms.NativeWindow.DefWndProc(Message& m)    at System.Windows.Forms.Control.DefWndProc(Message& m)    at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)    at System.Windows.Forms.Control.WndProc(Message& m)    at System.Windows.Forms.ButtonBase.WndProc(Message& m)    at System.Windows.Forms.Button.WndProc(Message& m)    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)    at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)    at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)    at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)    at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)    at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)    at System.Windows.Forms.Application.Run(ApplicationContext context)    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)    at USB6501App.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81    at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)    at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)    at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()    at System.Threading.ThreadHelper.ThreadStart_Context(Object state)    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)    at System.Threading.ThreadHelper.ThreadStart()
  InnerException:

 

_____________________

 

Could you help me what is the problem?. I tried the MAX test panel and VB6 application to test the counter. They work fine. Some how the interop.service call not access this COM.

 

Thanks for your help.

 

Tu 

0 Kudos
Message 3 of 6
(6,159 Views)

tnguyen,

 

What version of Traditional NI-DAQ do you have installed on your computer?  You can check in Measurement and Automation Explorer under the Software section.  Are you using the NI-DAQmx test panels or the Traditional NI-DAQ test panels?

Eric B.
National Instruments
0 Kudos
Message 4 of 6
(6,138 Views)

Hi Erric,

 

Thanks for your response. I am using the measurement studio 8.6 and 6 (support VB6). I installed the latest Traditional NI-DAQ driver 7.4.4. I am converting my old application from VB6 to VB .Net. I am trying to use the CWCounter activex within windows form. I added the icon CWCounter from toolbox in order the visual studio created the wrapper. However, in the code, when I called the function configure. It came the error as I posted. I also tried to fix as Document ID: 2Q1HG8A6 but it wasn't successfully.

 

I also tried to call API functions from dotnet but it always give error that "nidaq32.dll could not loaded due to initialize failed" even I copied the file in the same folder of program.

 

I have found that I have to create the wrapper VB6 activex to access the API functions to the generic counter for my dotnet application. It works perfectly.

 

For your answer, I have two counters: DAQAI16XE50 (PCMIA) and USB6501 (USB). I am not familiar with USB6501 due to the new NI-DAQmx develop. But I almost figured out how to make USB 6501 work as simple event counter with start, stop, reset and count. However, I still don't know how to detect the overflow when it counts like the one DAQAI16XE50 did.

 

I attached some captured images for your reference.

 

Thanks again for your support,

 

Tu Nguyen

 

niUSB6501_err_1.pngniUSB6501_err_2.pngniUSB6501_err_3.pngDAQ_activex_1.pngDAQ_activex_2.pngDAQ_activex_3.pngDAQ_activex_4.pngAPI_legacy_Net_1.pngDAQ_activex_5.pngDAQ_activex_6.png

0 Kudos
Message 5 of 6
(6,127 Views)

Tu,

 

So is your only question on how to get your USB-6501 to detect overflow using the NI-DAQmx driver?  I wouldn't recommend mixing the Traditional DAQ driver and the NI-DAQmx driver in one program, unless you are using the Traditional DAQ driver to access one card and the NI-DAQmx driver to access your other card.  Did this example work before you tried to modify it?

Eric B.
National Instruments
0 Kudos
Message 6 of 6
(6,102 Views)