LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

[Q]: LabView crash using Call Library Function vi

Hello,

I want to modify the master mixer audio volume.
I have found, on the Microsoft Development WWW
(http://support.microsoft.com/support/kb/articles/Q178/4/56.ASP)
two examples (one in Visual B and one in Visual C,
of course because these are Microsoft products)
that do what I want. They use the 'winmm.dll'
windows library. I just follow in LabView what
they have wrote in their Visual Basic example.
The LabView crash appears (I think) when I call
the 'mixerGetLineInfo' function. One of the
input parameters is a 'Type definition structure'
named 'MIXERLINE'. Two of the eighteen param
of the 'MIXERLINE' struct must be preload before
calling the 'mixerGetLineInfo' function. One
of these two preload paramete
r which is named
'cbStruct' must be preload with : size of
MIXERLINE structure.
Question N.1 : I use a cluster to build my
'MIXERLINE' structure. Am I right to do like that ?
Question N.2 : I have not found any 'vi Function'
which can give me the size of a cluster. Is there
one or not ?
Question N.3 : In the 'MIXERLINE' structure, three
parameters are define length string with
respectivly 16, 64 and 32 characters. How can I
do this in LabView ?

Thank you very much for help.
Best regards.
Mr FARGET Vincent
farget@olfac.univ-lyon1.fr
0 Kudos
Message 1 of 4
(2,584 Views)
Hi,

sorry but I can't help you cause I don't know. At the moment I also work
with the Library Function and I decided to create my own dll with the
needed WinAPI functions. So I'm able to set my parameters also for the
size of a structure. If you doesn't find a way to implement the function
just try out this way.

good luck
Henrik


Farget Vincent wrote:
>
> Hello,
>
> I want to modify the master mixer audio volume.
> I have found, on the Microsoft Development WWW
> (http://support.microsoft.com/support/kb/articles/Q178/4/56.ASP)
> two examples (one in Visual B and one in Visual C,
> of course because these are Microsoft products)
> that do what I want. They use the 'winmm.dll'
> windows library. I just follow in LabView what
> they have wrote in their Visual Basi
c example.
> The LabView crash appears (I think) when I call
> the 'mixerGetLineInfo' function. One of the
> input parameters is a 'Type definition structure'
> named 'MIXERLINE'. Two of the eighteen param
> of the 'MIXERLINE' struct must be preload before
> calling the 'mixerGetLineInfo' function. One
> of these two preload parameter which is named
> 'cbStruct' must be preload with : size of
> MIXERLINE structure.
> Question N.1 : I use a cluster to build my
> 'MIXERLINE' structure. Am I right to do like that ?
> Question N.2 : I have not found any 'vi Function'
> which can give me the size of a cluster. Is there
> one or not ?
> Question N.3 : In the 'MIXERLINE' structure, three
> parameters are define length string with
> respectivly 16, 64 and 32 characters. How can I
> do this in LabView ?
>
> Thank you very much for help.
> Best regards.
> Mr FARGET Vincent
> farget@olfac.univ-lyon1.fr
0 Kudos
Message 2 of 4
(2,582 Views)
Hello,

i just run into the same problem did you find a solution yet?

cheers

Holger
0 Kudos
Message 3 of 4
(2,541 Views)
I'm afraid that you can't map clusters to C structures like that because LabVIEW clusters are based off of internal multi-platform based constructs. There are some examples of passing clusters and using the "Adapt to Type" setting in the Call Library node, but that requires creating CIN-like code where you need to adapt LV data types into something else. I don't recommend going down that road.

Instead, I would recommend doing the wrapper DLL approach. If you have access to CVI, I recommend that because of the ease of importing CVI build DLLs into LV. If not, you can use Visual Studio or some other C compiler. Either way, create wrapper functions that take some basic types (strings, integers, doubles) from LV and then calls the Win32 API. Then convert the result back to basic types. This allows you to use the Call Library node.

Hope that helps
0 Kudos
Message 4 of 4
(2,527 Views)