Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

I am tryin gto use imaq.dll with VB.NET

I have added a NI-IMAQ Library reference to my VB.NET app but am unable to create an object of imaq type?
0 Kudos
Message 1 of 4
(7,182 Views)
TrackerMan,

In regards to the question that you posed in your post, I first need to point out that the NI-IMAQ driver and IMAQ Vision support Visual Studio 6.0, and are not designed to natively work inside the .NET programming environment. National Instruments has not verified the functionality of NI-IMAQ or Vision when used in Visual Studio .NET. If you are going to do development using a Visual Basic programming environment, I would recommend that you use Microsoft Visual Basic 6.0. This environment has been fully tested and is supported by the engineers on our technical support staff.

Having said that, I would like to point out that it MAY be possible to use this software with .NET. The .NET environment will allow you to run in unmanaged mode, which
should theoretically run the same way that Visual Basic 6.0 would, however, this has not been fully tested. We are aware of customers that have been successfully using Visual Studio .NET with NI-IMAQ and IMAQ Vision, and National Instruments' long-term plan for these products includes the addition of native support for Visual Studio .NET.

As for your specific trouble, I would recommend using one of the example programs that installed with NI-IMAQ or one of the example programs that are available for download from this website. I would suggest opening this example in your .NET environment and using that as a starting point for your programming. These examples will work in Visual Basic 6.0 and may work in Visual Basic .NET.

Beyond that, I will leave your question open to this forum, and hopefully there will be someone else who has found success using Visual Basic .NET that may be able to help you with your application.

Regards,
Jed R.
Applications Engineer
National Instrum
ents
0 Kudos
Message 2 of 4
(7,181 Views)
How do you run .NET in unmanaged mode?
0 Kudos
Message 3 of 4
(7,181 Views)
I believe what Jed meant was that the .NET framework allows you to call into unmanaged code ( code that does not use the .NET framework). This is done by making use of .NETinterop services.
Since there already exists a huge codebase that cannot all be re-written using .NET, Microsoft provides a way to be able to use that preexisting code and use it within a managed framework. If you need to call into functions that exists as dll's (such as the IMAQ API), you can make use of platform invoke services. This is the case where you would need to explicitly define each function that you are going to invoke from the unmanaged dll. Another mechanism is COM interop, in which the .NET framework allows you to use ActiveX and COM based components and controls from within a .NET application. This is slightly easier to use since the wrapper code ( code that basically "tricks" a .NET application into thinking the component you are calling is actually a native .NET component) is automatically generated for you by using various tools that Microsoft provides as a part of the .NET framework. If you have Visual Studio .NET installed, you probably already have those tools.
Microsoft provides certain wizards that "upgrades" a VB 6 application to a VB.NET application, but you still need to go into the code and make some hand tweaks to make everything run ( it is a wizard afterall ).
But the .NET framework and any application written using the framework is a managed application. You can use various mechanism provided to call unmanaged code (code written in C, C++, anything non .NET ). But you can�t run .NET in unmanaged mode.

In your case, I dont believe the IMAQ dll is a COM component, which means you will need to use platform invoke to call the functions in the dll. If you have the IMAQ ActiveX controls, that might make the transition to VB.NET easier. You find tons of information about this on Google ( or your favorite search engine) or on the MSDN.

I hope this helps

Bilal Durrani
NI
Bilal Durrani
NI
0 Kudos
Message 4 of 4
(7,182 Views)