In the following code, I get zero from GetProcAddress(...); with
GetLastError()
returning 126(=The specified module could not be found)
Any help would be appreciated...
HINSTANCE handleK32 = LoadLibrary("KERNEL32.DLL");
if (handleK32 != NULL)
{
LPFNDLLFUNC1 pfnDllFunc =
(LPFNDLLFUNC1)GetProcAddress(handleK32, "GetDiskFreeSpaceEx");
:
DWORD err = GetLastError();
:
Mark T...
The kernel is already loaded when your machine boots up so there is no need
to force this dll to load.
Anyway, you don't have to load the library to call this function, just
include winbase.h and call GetDiskFreeSpaceEx() as described in the help.
In the IDE, put your cursor on GetDiskFreeSpaceEx and press F1 to view the
help on its usage.
Hope this helps,
Steve M
If your running under WinNT or Win95 OSR2 do these steps
HINSTANCE hDLL = LoadLibrary("kernel32.dll");
if (hDLL)
{
#ifdef UNICODE
LPFNDLLFUNC1 procGetDiskFreeSpaceEx =
(LPFNDLLFUNC1)GetProcAddress(hDLL, "GetDiskFreeSpaceExW");
#else
LPFNDLLFUNC1 procGetDiskFreeSpaceEx =
(LPFNDLLFUNC1)GetProcAddress(hDLL, "GetDiskFreeSpaceExA");
#endif
if (procGetDiskFreeSpaceEx)
{
// Do something
}
FreeLibrary(hDLL);
}
Greg Gagnaux
Windows Software Developer
gagnaux@~ibm.net
remove ~ to email
> :