LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Windows API in my LabWindows CVI code

Hi all.

 

I would like any and all help. I am developing on LabWINDOWS 2010 and am trying to use the Windows API, particularly the multimedia APIs, in my CVI code. What I am trying to do is audio development, only it has to be in .NET or Visual C++ platform. I have developed the code and UIR, but when I build the solution it tanks on me. Of course when I use MS Visual C++ 2008 or 2010 there are no errors and I could use MS Visual C++ to develop my application, but the development of the user interface and the controls is much more straight forward with CVI and there are more controls to work with than there are with MS Visual C++. Most of the errors that I get are related to the following header files: "MMSystem.h", "devicetopology.h",  and the "endpointvolume.h". When I try and build a skelton project with no controls or indicators on the .UIR I get the errors like:

 

"devicetopology.h"(2301,20) Missing parameter type.

"devicetopology.h"(2301,40) syntax error; found '*' expecting ')'.

 "MMSystem.h"(151,1) Unrecognized declaration.

"MMSystem.h"(850,96) syntax error; found 'identifier' expecting ')'.

 

That is just a few of them, but they typically say the same thing. I have included the header files and libraries in my project, and  have made sure that they are in the CVI "sdk" directory. I have tried example code that have these header files and the result is still the same. I know that I should not have these type of issue, at least I don't think I should. Like I said I could use as much help as possible of figuring out what is the matter. Did I install the CVI improperly? Are there patches that I need to actually use windows APIs? I am attaching to this post my code and the code I downloaded from a LabWINDOWS forum. When I ran the code from the forum I got the same errors.   

 

Thanks in advance.

Download All
0 Kudos
Message 1 of 10
(6,359 Views)

Hi vehnasa1,

 

AudioVolume should compile okay. For using devicetopology.h, try defining NTDDI_VERSION before your include statements.

Humphrey H.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 10
(6,325 Views)

Humphreyy,

 

thanks for the tip. I tried it but it did not work, the same errors were present. Are there any other suggestions. I have racked my brain to figure out why this is happening and have come up with nothing. I am also getting a "Warning" message concerning the "KsMedia.h" file that says "Warning: Excess characters in multibyte character literal ignored." The warnings trace back to the "typedef enum" section of that file. Could that be causing a ripple effect that produces the error I am seeing in the other header files I mentioned??

I could really use your help and any more help that is available. I really don't want to use Visual C++, because this software is going to get more sophisticated and is to be used in NASA Langley's VISTAS simulator, an environment taylor made for National Instruments software.

0 Kudos
Message 3 of 10
(6,308 Views)

How did you define NTDDI_VERSION? 
I can't actually compile your entire code but the headers compiled okay (I removed the ones that I do not have)

Humphrey H.
Applications Engineer
National Instruments
0 Kudos
Message 4 of 10
(6,281 Views)

I just defined it the usual way user defines are done: #define . Which header files did you have to remove??

0 Kudos
Message 5 of 10
(6,274 Views)

These compile fine for me:

#define NTDDI_VERSION NTDDI_WIN7 

#include <windows.h>
#include <devicetopology.h>
#include <ansi_c.h>
#include <cvirte.h>
#include <userint.h>
#include <stdio.h>

 

and

 

#include <windows.h>
#include <mmsystem.h>
#include <cvirte.h>		
#include <userint.h>
Humphrey H.
Applications Engineer
National Instruments
0 Kudos
Message 6 of 10
(6,250 Views)

Humphry,

 

I tried the last suggestion and got the same problem. Anymore thoughts. Is it possible that I have installed CVI incorrectly or something. This is truly bizarre. If you have anything else I am willing to give it a go. I am at a lose.

0 Kudos
Message 7 of 10
(6,218 Views)

So it's giving the same errors?

Do examples that use windows.h compile okay? 

Humphrey H.
Applications Engineer
National Instruments
0 Kudos
Message 8 of 10
(6,196 Views)

Humphrey,

 

yes there are examples that have windows.h that run. I even have code that I have developed that has the windows.h header in it and they build with no errors at all, but the earlier mentioned header additions are causing error explosions. That is why this is really puzzling me.

0 Kudos
Message 9 of 10
(6,191 Views)

If trying to compile just the headers that I listed is giving you errors, I wonder if some of those files are missing on your computer. You might want to double check on that.

Humphrey H.
Applications Engineer
National Instruments
0 Kudos
Message 10 of 10
(6,174 Views)