win32api.SetLastError

int = SetLastError()

Sets the calling thread's last error code value.

Win32 API References

Search for SetLastError at msdn, google or google groups.