Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

Never use the GetLastError API function
[ All Languages » VB »  Api]

Total Hit ( 2244)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


If you heavily use API calls and strictly follow the SDK documentation, you might be tempted to use the GetLastError API to retrieve the error returned by your last API function or procedure. However, this function doesn't always return valid error codes, because Visual Basic internally does a lot of calls to the Windows API, therefore it is highly likely that the value returned by the GetLastError function actually refers to one of those internal calls, rather than your most recent explicit call.

To work around this problem, just use the LastDLLError property of the Err object. Visual Basic always caches in this property the error code returned by any call to a routine to the Windows API. Unfortunately, you cannot disable this mechanism, which means that all your calls to the API are slowed down, even if you're not interested in error codes.


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.