LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

DLLVERSIONINFO2

Solved!
Go to solution

I had written DLL's using CVI 2009 and earlier that referenced DLLVERSIONINFO2 to query and report the DLL version at runtime to the calling code.  Now when I compile this code on the same system (Win XP) it can't find a definition for it.  Is this due to the new treatment of WInSDK in CVI 2010?  Anybody solved this?

0 Kudos
Message 1 of 8
(3,354 Views)

It turns out that the header file     shlwapi.h  has changed between CVI 2009 and CVI 2010.

 

Did NI make these changes or did Microsoft?  The two different files are both labeled Version 1.0  Smiley Frustrated

 

2009 shlwapi.h  that compiles OK:

 


/*****************************************************************************\
*                                                                             *
* shlwapi.h - Interface for the Windows light-weight utility APIs             *
*                                                                             *
* Version 1.0                                                                 *
*                                                                             *
* Copyright (c) Microsoft Corporation. All rights reserved.                   *
*                                                                             *
\*****************************************************************************/


#ifndef _INC_SHLWAPI
#define _INC_SHLWAPI

#ifndef NOSHLWAPI

#include <objbase.h>
#include <shtypes.h>


#ifndef _WINRESRC_
#ifndef _WIN32_IE
#define _WIN32_IE 0x0501
#else
#if (_WIN32_IE < 0x0400) && defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0500)
#error _WIN32_IE setting conflicts with _WIN32_WINNT setting
#endif
#endif
#endif

 

Below is the front of the CVI 2010 shlwapi.h  that does not compile.  Note that it does not try to define _WIN32_IE at version 0x501, and in fact there is no definition for this preprocessor variable present, so the DLLVERSIONINFO2 struct is subsequently also not defined:

 

/*****************************************************************************\
*                                                                             *
* shlwapi.h - Interface for the Windows light-weight utility APIs             *
*                                                                             *
* Version 1.0                                                                 *
*                                                                             *
* Copyright (c) Microsoft Corporation. All rights reserved.                   *
*                                                                             *
\*****************************************************************************/

#ifndef _INC_SHLWAPI
#define _INC_SHLWAPI

#ifndef NOSHLWAPI

#include <SpecStrings.h>
#include <objbase.h>
#include <shtypes.h>



0 Kudos
Message 2 of 8
(3,334 Views)
Solution
Accepted by topic author menchar

It looks like a way to handle this is to define _WIN32_IE for yourself either as a compiler command line option or in your code.

 

_WIN32_IE is a legacy thing that goes back to when micro$oft was putting shell items in Internet Explorer (I suspect this was back when they were trying to lock everyone into using IE but got litigated for it later).  It looks like the CVI 2009 version of shlwapi.h defined a default value for _WIN32_IE as 0x0501, and this then allowed DLLVERSIONINFO2 to get defined later on in shlwapi.h. 

 

But the CVI 2010 version of shlwapi.h lacks this default definition.

 

The current MSDN documentation for using the windows headers says it's "you must define" _WIN32_IE. So maybe microsoft removed the default definition.

 

Supposedly you can set NTDDI_VERSION to a version value and it will in turn set the various legacy version definitions (e.g. WINVER) for you, but users are commenting that this doesn't always work.

 

 

Message 3 of 8
(3,325 Views)

Thanks Menchar for getting on this and tracking it down for us.  You rock!

0 Kudos
Message 4 of 8
(3,323 Views)

Nice work Menchar! To clarify some CVI specific points. CVI 2010 updated the Windows SDK to v7.0. It was Microsoft who dropped this declaration from the shlwapi header. It looks like it actually defaults to 0x0500 if not defined by the user. More info can be found on this MSDN article: http://msdn.microsoft.com/en-us/library/windows/desktop/bb776779%28v=vs.85%29.aspx.

National Instruments
0 Kudos
Message 5 of 8
(3,305 Views)

I love having public discussions with myself Smiley Very Happy  It's a shame I can't give myself kudos.

 

Unfortunately, the DLLVERSIONINFO2 definition in shlwapi.h is guarded by a check for version 0x0501 so it fails to define by default.   So the trick becomes where to define WIN32_IE in your CVI code, or specify it as a compiler directive but not sure the CVI compilers can do this like VSCPP.

 

I had searched MSDN, that's how I was able to answer my question - SDK help no longer in CVI, though I see you do still supply SDK headers and import libraries - have these been reworked by NI or are they straight from micro$oft?   Is there any reason to use these as opposed to SDK headers and import libraries obtained directly from micro$oft?

0 Kudos
Message 6 of 8
(3,300 Views)

The CVI compiler can define constants just like VC. Look in Build Options under the Configuration Options tab at the bottom.

 

I would recommend using the CVI version of the Windows SDK because we do add CVI specific information to the headers (usually commented as such).

National Instruments
Message 7 of 8
(3,295 Views)

Thanks for the info, I appreciate it.

0 Kudos
Message 8 of 8
(3,291 Views)