LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Managed DirectSound, hWnd, LV 7

Hi,

I am trying to use managed (.net) DirectSound with Labview 7. My end-goal is
to use the soundcard's gain control when playing/recording sounds. I looked
at a win32 example on ni.com (didnt work) and the ActiveX interface (Labview
greyed out some important functions) so the managed version seemed like the
best option.

After adding the Device constructor, I'm stuck on SetCooperativeLevel which
requires an owner parameter. I think the documents ask for an hWnd, but the
datatype is .net refnum

What would I wire to this input?

Thanks!

-joey
0 Kudos
Message 1 of 2
(2,966 Views)
Joey,

I've never done .NET DirectSound myself, however I have a couple of things to add. LabVIEW will use the .NET reference object for any datatype unknown to LabVIEW. So in this case I guess LabVIEW does not recognizes the hWnd type and switches to the .NET reference.

If the assembly requires a the hWnd of the owner, I guess it is looking for the Windows handle of the calling application. Here you can find an example on getting the window handle of your VI. I'm not sure of the specifics, however from those VIs you should be able to get the window handle and pass it to the .NET assembly.

There is also the po
ssibility of creating a dll in C/C++ usign the Win32 functions for the mixer. This is a good link for the mixer API.

I hope this helps.

Regards,

Juan Carlos
N.I.
0 Kudos
Message 2 of 2
(2,966 Views)