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

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

How to Return The String Version Of An API Error

Many of the Windows API functions return errors, but what do they actaully mean.

Usually the develeper would have to look the error up in the platform SDK or use a thrid part utility, but by using the function below you can accomplish the same.

NB: The MW Code LIbrary contains function to access error strings for custom DLLs as well.

Property Get GetErrorString()
Dim sTemp As String, lTemp As Long
sTemp = String(100, 0)
lTemp = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM Or FORMAT_MESSAGE_IGNORE_INSERTS, vbNullString, lError, 0&, sTemp, Len(sTemp), ByVal 0&)
GetErrorString = Left$(sTemp, lTemp)
End Property

Home

___________________________________________

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

Terms of Use

© 1999 MW Software, all rights reserved