LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

SetDllDirectory Enable

Is there something I have to define to get the windows SDK function "SetDllDirectory" to be included in CVI's version of the windows SDK? (besides WINVER >= 0x500)
or is there otherwise a reason why it is not found when I include windows.h from CVI's windows SDK?
 
BOOL WINAPI SetDllDirectory(  LPCTSTR lpPathName);
is normally declared in Winbase.h and is part of Kernel32 in a normal windows SDK distribution.
 
I can call other functions in the same library (LoadLibrary, FreeLibrary, etc) but there is no prototype defined for SetDllDirectory?
 
Greg
0 Kudos
Message 1 of 2
(5,568 Views)
Hi Greg,

The reason that you can't find that function in the CVI version of the Windows SDK is because we ship with the Window 2000 RC2 version of the SDK. The SetDllDirectory is part of the Windows XP SP1 and Windows Vista SDK.  We are planning on updating our version of the SDK in the future so that you can take advantage of these new SDK functions. 

For now, you have a few options of either

1) Using LoadLibrary and GetProcAddress to load up the Windows XP version of the Kernel32.dll which implements that function. 
2) Grab the Kernel32.lib import library from Microsoft or from Visual Studio SDKs and then replace our Kernel32.lib library in the <CVI>\sdk\lib\msvc\ directory. However, you must also extern the function in your code since our header files don't know anything about this function.

I tested the 2nd case out and it worked fine for me. For example, you could say something like;

#include "Windows.h"

extern BOOL WINAPI SetDllDirectoryA(LPCTSTR lpathName);

int main()
{
    BOOL status;
   
    status = SetDllDirectoryA("C:\\blah);
    return 0;
}


See Microsoft's SetDllDirectory for more information.

Hope this helps!

Best Regards,

Message Edited by Jonathan N on 11-02-2007 08:46 AM

Jonathan N.
National Instruments
0 Kudos
Message 2 of 2
(5,549 Views)