基于LabVIEW的可执行文件调用的研究与实现.doc
文本预览下载声明
基于LabVIEW的可执行文件调用的研究与实现
潘亚平 赵燕平 苏禹 王鹏
(中国科学院等离子体物理研究所 安徽合肥 230031)
摘要:LabVIEW是美国NI公司推出的一种基于G语言的虚拟仪器软件开发工具。在LabVIEW开发的软件中,用户可能需要调用.exe可执行文件。本文结合实例详细介绍了三种调用方法:通过Call Library Function调用Windows API函数来实现;利用lvwutil32.dll来实现;调用System Exec.Vi来实现。本文还分析了这三种调用方法之间的区别。
关键词:LabVIEW 可执行文件 ShellExecuteA lvwutil32.dll
中图分类号:TP319 文献标识码:A
Loading and Running of an Executable File Based on LabVIEW
Pan,Yaping Zhao,Yanping Su,Yu Wang,Peng
(Institute Of Plasma Physics, Academia Sinica, AnHui Hefei 230031, China)
Abstract:LabVIEW is a virtual instrument software developing tool based on G language developed by National Instrument Company of America.During developing,the user may need to load and run an executable file.This paper introduces three kinds of methods in detail with abundant legends:call windows API functions to implement by Call Library Function palette;using lvwutil32.dll to implement;call System Exec.vi to implement.This paper also analyses the difference between them.
Keywords:LabVIEW executable file ShellExecuteA lvwutil32.dll
1 引 言
LabVIEW(Laboratory Virtual Instrument Engineering Workbench,实验室虚拟仪器工程平台)是美国NI公司(National Instrument Company,简称NI公司)推出的一种基于G语言(Graphics Language,图形化编程语言)的虚拟仪器软件开发工具[1]。
LabVIEW提供了功能丰富的库函数,开发人员可轻松组建一个测量系统以及构造自己的仪器面板,而无需进行任何烦琐的程序代码的编写。但在LabVIEW开发的软件中,用户可能需要调用某个可执行文件(.exe文件),有三种方法可以实现装载并运行可执行文件的
功能:通过Call Library Function调用Windows API函数来实现;利用lvwutil32.dll来实现;通过调用System Exec.Vi来实现。
2 基于LabVIEW的可执行文件调用的实现
在数据采集系统中,对于NI公司生产的数据采集卡,用户需要调用Measurement Automation来配置数据输入与输出通道。Measurement Automation应用程序文件NIMax.exe位于C:\Program Files\National Instruments\MAX文件夹中。在LabVIEW开发的软件中调用NIMax.exe,可通过以下三种方法来实现。
2.1 通过Call Library Function子模板调用Windows API函数
将LabVIEW的Function Palette(功能模板)的Advanced模板中的Call Library Function子模板放至流程图编辑窗口中,单击选择Configure…,出现图1。设置Library Name or Path为C:\WINNT\system32\SHELL32.DLL,Function Name为ShellExecuteA,Calling Conventions为stdcall(WINAPI)。
图1
ShellExecuteA 函数原型为Int32
显示全部