Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
WSAGetLastError() returns 0?
Message
 
 
À
09/09/2009 05:15:04
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Divers
Thread ID:
01423227
Message ID:
01423234
Vues:
46
>Was wracking my brains trying to figure out why WSAGetLastError() was always returning 0, despite WinSock functions return codes would indicate an error had occurred. For example after connect() might return SOCKET_ERROR, but WSAGetLastError() was always returning 0 (which isn't very useful, as I could tell it failed, but no way to determine the reason).
>Then it dawned on me -- what about the _VFP.AutoYield setting? (after seeing various message postings regarding similar problem in Visual Basic) Sure enough, setting _VFP.AutoYield to .F. prior to the API function call allowed me to retrieve the actual error code (VFP was apparently resetting the error code in the background -- thus WSAGetLastError() was always returning 0).

Calvin discusses similar behavior for GetLastError() at http://blogs.msdn.com/calvin_hsia/archive/2006/05/03/589348.aspx in VFP8 and earlier.
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform