Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Using External Code in LabVIEW.pdf
Скачиваний:
49
Добавлен:
29.05.2015
Размер:
1.85 Mб
Скачать

Chapter 2 Shared Libraries (DLLs)

This VI generates the following message box.

Figure 2-8. Running a LabVIEW Call to the Win32 API

Additional Examples of LabVIEW Calls to DLLs

You can access several other examples to learn more about calling DLLs from LabVIEW.

If you have a sound card with Windows sound drivers installed on your system, investigate the Play Sound VI found in the LabVIEW Examples directory:

\LABVIEW\EXAMPLES\DLL\SOUND\PLAYSND.LLB\Play

Sound.vi

You can use this VI to play Windows .WAV sound files on your computer from LabVIEW.

If you do not have a sound card you can generate a sound in your PC speaker by calling the MessageBeep function in User32.DLL.

The function prototype is:

VOID MessageBeep(UINT uType);

The LabVIEW example VI Hostname returns the host name of your computer, demonstrating how to use LabVIEW string handles:

\LABVIEW\EXAMPLES\DLL\HOSTNAME\hostname.vi

You can programmatically position your cursor anywhere on your monitor using the SetCursorPos function in User32.DLL. The function prototype is:

BOOL SetCursorPos(INT x, INT y);

x and y are the coordinates you want, referenced from the upper left corner of the screen. The return value is TRUE if the function was successful and FALSE if it was unsuccessful. Remember that the value returned is type BOOL, which is defined in the Win32 API as a 32-bit signed integer with values 0=FALSE and 1=TRUE.

© National Instruments Corporation

2-25

Using External Code in LabVIEW

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]