LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Library Function Error

Hello,
 
i have written a program in LabWindow/CVI 6.0 that is using a serial COM-Port and the WindowsMediaPlayer by ActiveX. The part using the WMP allready worked, afterwards i wrote also the part of the program using serial Port. Since i have written the part for the serial Port the WMP part doesn't work anymore because of a library function error.
 
Used Libs:
     #include <cvirte.h>
     #include "wmp.h"
     #include <utility.h>
     #include <userint.h>
     #include <rs232.h>
     #include "asynctmr.h"
 
Code:
     int SoundFiles = SndFiPanel_SelectedSoundFiles; (SelectedSoundFiles is a Listbox on the Panel SndFiPanel)
     ClearListCtrl (SndFiPanel, SoundFiles);                                //The Run-Time Error comes by this function call
 
Error Message:
     NON-Fatale Run-Time Error
     Library function Error (return value == -60)
     Control passed must be a list control.
 
Has somebody an idea what the problem is?
 
Greetings Paco
0 Kudos
Message 1 of 3
(2,986 Views)

The most probable cause of this error is an incorrect value used as the panel handle in ClearListCtrl ().

Since the list control is named SndFiPanel_SelectedSoundFiles, it means that SelectedSoundFiles is the constant name of the list control on the panel while SndFiPanel is the constant name with which you have called the panel in the UIR editor. This is NOT the panel handle with which to address the panel and its controls: the panel handle is the value returned by LoadPanel () function.

That is, your code is to be modified as follows:

handle = LoadPanel (0, "file.uir", SndFiPanel);    // Made elsewere in the program

int SoundFiles = SndFiPanel_SelectedSoundFiles;   //SelectedSoundFiles is a Listbox on the Panel SndFiPanel
ClearListCtrl (handle, SoundFiles);                                //The Run-Time Error comes by this function call
 
It may have happened that the panel handle had the same value as its constant name, but it is to be considered as a mere coincidence. It may have happened that adding the portion of code which is in charge of the serial communication you have altered this coincidence loading another panel before that of the sound part of the application or something like this, getting the error due to the incorrect value used as the panel handle.


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 3
(2,980 Views)
Thanks for helping me. The program is working now.
 
Greetings Paco
0 Kudos
Message 3 of 3
(2,976 Views)