Free Web Hosting Provider - Web Hosting - E-commerce - High Speed Internet - Free Web Page
Search the Web

MW-Menu

 

Free Visual BASIC Newsletter

Features

Tips

Sample Code

Newsletters

Products

ActiveX

Cool Links

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Determining Whether An API Function Exists

As Microsoft releases updates to there operating systems some API function become obsolete. You can programmatically check whether an API function exists by using the function below

Public Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
Public Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long
Public Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long

Public Function IsFunctionValid(sName As String) As Boolean
Dim lTemp As Long
lTemp = LoadLibrary("User32.dll")
IsFunctionValid = CBool(GetProcAddress(lTemp, sName))
FreeLibrary (lTemp)
End Function

If True is returns the function exists and False if it doesn't exist

Home

___________________________________________

Send Bugs, comments to the webmaster at webmaster@mwe.8m.com

Terms of Use

© 1999 MW Software, all rights reserved