win32api.GetLastError

int = GetLastError()

Retrieves the calling thread's last error code value.

Win32 API References

Search for GetLastError at msdn, google or google groups.