cpubbs论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

LabVIEW+单片机学习套件全套教程资料下载[免费]LabVIEW论坛精华列表贴USB0816数据采集卡《LabVIEW宝典》
LabWindows/CVI论坛精华贴NET0816以太网数据采集卡RC0210远程设备授权系统 关闭关停锁定打开设备 户外分布式数据采集
NET1624低速高精度以太网数据采集卡WIFI0824SD无线WIFI网络数据采集卡脱机运行 SD存储 小尺寸微型 串口采集远程采集 安卓 手持移动采集 纪录仪
查看: 1297|回复: 3

在LabWindows中使用.NET 控件写的DLL

[复制链接]
发表于 2009-2-26 10:10:52 | 显示全部楼层 |阅读模式
本帖最后由 luoxianli 于 2009-2-26 10:14 编辑

    近来碰到在LabWindows中使用.NET 控件写的DLL,最开始不知道怎末用,没有.h文件, 而且DLL函数查看器无法查看函数,也就是说.NET 控件写的DLL不是我们一般通用的DLL。反复摸索终于找到解决办法,请参照下面两步:
1. .NET Framework Error Message When Using the .NET Controller Wizard in LabWindows/CVI
Primary Software: LabWindows/CVI Development Systems>>Base Package
Primary Software Version: 8.5
Primary Software Fixed Version: N/A
Secondary Software: LabWindows/CVI Development Systems>>Base Package

Problem:
When I select Tools » Create .NET Controller, I receive the following error message: "Could not load required CVI .NET modules. Install .NET Framework version 1.1 or higher
and repair the CVI and CVI Runtime Engine installers to install the CVI .NET modules."

Why am I receiving this error and what I can do to fix it?

Solution:
When you install LabWindows/CVI, we check the registry to determine if the .NET Framework 1.1 or higher is installed. If so, we install .NET support onto the system.
The message above is simply stating that LabWindows/CVI .NET components are not installed. Typically you run into this scenario if you installed the .NET Framework after you installed LabWindows/CVI.
To install LabWindows/CVI .NET support, reinstall LabWindows/CVI or repair the existing LabWIndows/CVI installation.
After repairing or reinstalling, the error message should disappear.
2. Create LabWindows/CVI .NET Controller Dialog BoxUse the Create LabWindows/CVI .NET Controller dialog box to generate a LabWindows/CVI wrapper for a .NET assembly. LabWindows/CVI generates the wrapper in the form of an instrument driver, source file, and header file. You also can use the LabWindows/CVI .NET Library functions in conjunction with the generated wrapper when calling a .NET assembly.
Note   LabWindows/CVI supports .NET framework version 1.1 or later. To create a LabWindows/CVI wrapper for a .NET assembly or to use the .NET Library, you must have .NET 1.1 or later installed on your computer. You can download the .NET framework from the Microsoft Web site.

If you install the .NET framework after you install LabWindows/CVI, you must then reinstall LabWindows/CVI or repair the existing LabWindows/CVI installation.

Select Tools»Create .NET Controller to open the Create LabWindows/CVI .NET Controller dialog box. The Create LabWindows/CVI .NET Controller dialog box provides the following controls:

  • Assemblies in Global Assembly Cache—Lists the .NET assemblies that are available in the Global Assembly Cache (GAC) on your computer. If you enable the Specify Assembly by Path option, this control is not available. The Assemblies in Global Assembly Cache list provides the following information:
    • Name—The assembly name.
    • Version—The version number of the assembly. This number consists of major and minor version numbers.
    • Culture—The language or region the assembly targets. The culture can affect strings, time, currency formats, and so on. Neutral indicates that the assembly does not target a specific language or region.
    • Public Key Token—The key, provided by the assembly creator, that is used for security and cryptographic purposes.
    Note   If two or more assemblies differ by name, version, culture, or public key token, .NET considers them to be different assemblies.
  • Specify Assembly by Path—Specifies whether to generate the wrapper for the .NET assembly in the Assembly Path control. If you enable this option, the Assemblies in Global Assembly Cache control is not available.
  • Assembly Path—Specifies the path and filename of the .NET assembly for which LabWindows/CVI generates a wrapper. You can use the Browse button to browse to the .NET assembly.
  • Target Instrument—Specifies the path and filename of the instrument driver LabWindows/CVI generates. You can use the Browse button to browse to a new or existing .fp file.
  • Add Instrument to Project—Specifies whether to add the generated .fp file to the current project.
Note   LabWindows/CVI returns an error if you attempt to run multiple instances of the Create LabWindows/CVI .NET Controller dialog box at the same time.

When you click OK, LabWindows/CVI opens a renaming dialog box, which you can use to modify the names of .NET identifiers in the target assembly.
After LabWindows/CVI generates the wrapper, it opens a dialog box that indicates it has successfully generated an instrument driver to control the selected .NET assembly. If the selected assembly references types that are defined in other assemblies, the dialog box displays a list of the names and locations of the assemblies in which these types are defined. You must generate wrappers for the assemblies if you need full access to the types defined in them. If the wrapper generation process returned errors and/or warnings, the dialog box displays a Warnings and Errors section.

评分

参与人数 1经验 +20 收起 理由
cpubbs + 20

查看全部评分

发表于 2009-2-26 13:09:10 | 显示全部楼层
说真的,用.NET那么久了(现在装的是Visual Studio 2008 Team Suite sp1),就是不明白CVI中的.NET是干啥用的!
呵呵。。。学习了!
 楼主| 发表于 2009-3-3 09:30:50 | 显示全部楼层
发表于 2009-3-3 17:56:34 | 显示全部楼层
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|cpubbs论坛. ( 粤ICP备09171248号 )

GMT+8, 2025-4-21 07:55 , Processed in 0.508883 second(s), 7 queries , Gzip On, File On.

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表