-
February 2nd, 2007, 12:21 PM
#1
Linking issue with NcFreeNetconProperties
Hey folks,
I got a real simple question: I can't link with: NcFreeNetconProperties.
VS2005's linker returns:error LNK2019: unresolved external symbol _NcFreeNetconProperties@4
I need to use this call because I earlier involked:
GetProperties(NETCON_PROPERTIES **ppProps)
Last edited by werpa; February 2nd, 2007 at 02:44 PM.
Reason: Preview didn't show bizarre characters so had to edit them out.
-
February 2nd, 2007, 03:52 PM
#2
Re: Linking question on NcFreeNetconProperties(NETCON_PROPERTIES*);
Accroding to the documentation you shouldn't use this function:
Originally Posted by MSDN
[Internet Connection Firewall may be altered or unavailable in subsequent versions. Instead, use the Windows Firewall API.]
Anyway, you can try to dynamically link the function at runtime:
Code:
#include <windows.h>
#include <tchar.h>
#include <NetCon.h>
typedef void (WINAPI *PFNNcFreeNetconProperties)(NETCON_PROPERTIES* pProps);
int main(int argc, char* argv[])
{
// function pointer
PFNNcFreeNetconProperties NcFreeNetconProperties;
// load DLL
HMODULE hDLL = LoadLibrary(_T("netshell.dll")); // or hnetcfg.dll
if (!hDLL)
{
// dll not found
return 0;
}
// get procedure address
NcFreeNetconProperties = (PFNNcFreeNetconProperties)GetProcAddress(hDLL, "NcFreeNetconProperties");
if (!NcFreeNetconProperties)
{
// procedure not found
return 0;
}
// call procedure
NcFreeNetconProperties( ... );
// Free dll when done
FreeLibrary(hDLL);
return 0;
}
- petter
-
February 2nd, 2007, 03:59 PM
#3
Re: Linking question on NcFreeNetconProperties(NETCON_PROPERTIES*);
This works. Thanks much. BTW, this is an MFC app. Is is more appropriate to use AfxLoadLibrary?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|