Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GetLastError returns 0

Status
Not open for further replies.

UdoScheuvens

Programmer
Apr 12, 2001
42
DE
I have the problem that GetLastError returns the error code "0" although the return value of the previous function call returned unsuccessful.

Example:

hInst = LoadLibrary("c:\test\xxx.dll")
lErr = GetLastError()

The library doesn't exist and so the function must fail.

If this code is written in VB, the results are:
hInst = 0
lErr = 0

The same code written in VC results in
hInst = 0
lErr = 1157 (ERROR_DLL_NOT_FOUND)

This effect occurs with many other API calls.
Does anybody know how to get the correct error code in VB?

Udo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top