To answer your main question, the problem probably is that _WIN32_DCOM is not defined for your project. Go to the Project>>Settings>>C/C++ tab. Make sure General is selected in the Category dropdown list control. At the end of the Preprocessor Definitions list add _WIN32_DCOM (make sure you use a comma to separate it from the other definitions). Do this for every configuration (Release and Debug).
For your original issue, I'm not sure if you mean 1) that you need to write a program that returns a value that you use; or 2) that you need to launch an .exe from within your program and capture its return value. For case 1, you can write a CVI program that returns the value from main. If you need the result from within a batch file, you use %errorlevel% to get
it. For case 2, you can either work around the issue by writing a series of CVI programs and passing their results to each other in a batch file or go with a C++ program that calls _spawn.
David Rohacek
National Instruments