Determine if an API Function is Available

Category:
System/API
Type:
Snippets
Difficulty:
Intermediate
Author:
Intelligent Solutions Inc.

Version Compatibility:

More information:
There are some API functions that are available on some platforms but not others. For example, GetDiskFreeSpaceEx, the preferred function for determining free disk space, is not available on pre-SP2 versions of Windows 95. This code allows you to check whether an API function is available before attempting to call it.

NOTE: If the function has an alias in its declaration, you pass this alias to the FunctionName argument. For example, to determine if GetDiskFreeSpaceEx is available, you must pass its alias, GetDiskFreeSpaceExA, to the FunctionName argument.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: