Eddie posted:
When I use “IP Helper API’s functions” In my program, all is ok. until I
run it on Windows 98.
On Windows Xp everything is ok.
On 98 I get an error:
MsgBox:
File MyApp.exe is
linked with missing export IPHLPAPI.DLL:GetPerAdapterInfo
I checked it with IPHLPAPI.DLL 5.0.1717.2 and 5.1.2600.2.
The first one is from 98 and I get with it this error.
The second one is from xp (works fine), but she won’t work when I copy
it do 98.
How to fix his problem?
OFF-TOPIC
On the Win98 system, it can't find the function entitled
"GetPerAdapterInfo" inside the file "IPHLPAPI.DLL".
If I'd to guess, then I'd say that this particular function was only added
to the library recently.
You can go to "
www.dependencywalker.com", and download a nice tool to see
what DLLs and functions are involved.
Anyway, to the solution...
Do you need the program to be able to run on Win98? If not, it doesn't
matter.
If you *do* want the program to run on Win98, how would you best describe
your situation:
A) The use of this function is vital in the program
B) The use of this function is a nice feature, but if needs be I won't use
it.
If your answer is A, then your only option is to package the newer version
of this DLL with your executable, or provide a readme.txt that contains a
link to DLL online or something like that.
Now, if you answer is B, here's the beauty:
HMODULE hDLL = LoadLibrary("IPHLPAPI.DLL");
if (!hDLL) { throw "Poo!"; }
return_value (*GetPerAdapterInfo)(arguments);
GetPerAdapterInfo = GetProcAddress(hDLL,"GetPerAdapterInfo");
if (!GetPerAdapterInfo)
{
FreeLibrary(hDLL);
throw "Poo!";
}
//Now you can use the function as normal
Don't forget to free the library at the end
FreeLibrary(hDLL);
I'm sure there must be some sort of template class out there that'll do this
for you, one that will free the library upon an exception and so on. If
there ain't, I might waste an hour or so of my time on one!
-JKop