网站首页  词典首页

请输入您要查询的函数:

 

术语 getlasterror
释义 GetLastError
语法:
C++
DWORD WINAPI GetLastError(void);
GetLastError函数
检索调用线程的最后错误代码值。最后,错误代码是在保持每个线程的基础。多线程不会覆盖彼此的最后错误代码。
Visual Basic中:应用程序应该呼吁err.LastDllError,而不是GetLastError函数。
参数
这个函数没有参数。
返回值
返回值是调用线程的最后错误代码。
返回值对每个功能设置上,错误代码的文档部分说明的条件下,该函数设置最后错误代码。大多数功能设置线程的最后错误代码设置时失败。但是,某些功能还设置上,错误代码时,他们取得成功。如果函数未记录的设置上,错误代码,这个函数返回的值仅仅是最近的最后错误代码已经确定,部分功能设置上,错误代码为0的成功,有些人不。
备注
由调用线程执行的函数通过调用SetLastError函数此值。您应该调用GetLastError函数时立即函数的返回值表示,这样的调用将返回有用的数据。这是因为一些函数调用时零成功SetLastError,消灭错误代码由最近失败的函数集。
要获得对系统的错误代码的错误字符串,请使用FormatMessage函数。如需由操作系统提供的错误代码的完整列表,请参见系统错误代码。
该错误由函数返回的代码不是Windows API规范的一部分,可以改变作业系统或设备驱动程序。由于这个原因,我们无法提供的错误可以由每个函数的返回代码的完整列表。也有许多职能的文件不包括甚至是错误代码可以返回部分清单。
错误代码是32位值(31位,是最重要的位)。位29是保留给应用程序定义的错误代码,没有系统错误代码此位设置。如果要定义为您的应用程序错误代码,将其设置为1位。这表明,错误代码是由一个应用程序定义的,并确保您的错误代码不与系统定义的任何错误代码冲突。
要转换成一个HRESULT值系统错误,请使用HRESULT_FROM_WIN32宏。
实例
有关示例,请参见检索最后,错误代码。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
参见
错误处理函数
FormatMessage
HRESULT_FROM_WIN32
最后,错误代码
SetLastError
SetLastErrorEx
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月30日
==英文原文==GetLastError Function
Retrieves the calling thread's last-error code value. The last-error code is maintained on a per-thread basis. Multiple threads do not overwrite each other's last-error code.
Visual Basic: Applications should call err.LastDllError instead of GetLastError.
Syntax
C++
DWORD WINAPI GetLastError(void);
Parameters
This function has no parameters.
Return Value
The return value is the calling thread's last-error code.
The Return Value section of the documentation for each function that sets the last-error code notes the conditions under which the function sets the last-error code. Most functions that set the thread's last-error code set it when they fail. However, some functions also set the last-error code when they succeed. If the function is not documented to set the last-error code, the value returned by this function is simply the most recent last-error code to have been set; some functions set the last-error code to 0 on success and others do not.
Remarks
Functions executed by the calling thread set this value by calling the SetLastError function. You should call the GetLastError function immediately when a function's return value indicates that such a call will return useful data. That is because some functions call SetLastError with a zero when they succeed, wiping out the error code set by the most recently failed function.
To obtain an error string for system error codes, use the FormatMessage function. For a complete list of error codes provided by the operating system, see System Error Codes .
The error codes returned by a function are not part of the Windows API specification and can vary by operating system or device driver. For this reason, we cannot provide the complete list of error codes that can be returned by each function. There are also many functions whose documentation does not include even a partial list of error codes that can be returned.
Error codes are 32-bit values (bit 31 is the most significant bit). Bit 29 is reserved for application-defined error codes; no system error code has this bit set. If you are defining an error code for your application, set this bit to one. That indicates that the error code has been defined by an application, and ensures that your error code does not conflict with any error codes defined by the system.
To convert a system error into an HRESULT value, use the HRESULT_FROM_WIN32 macro.
Examples
For an example, see Retrieving the Last-Error Code .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
See Also
Error Handling Functions
FormatMessage
HRESULT_FROM_WIN32
Last-Error Code
SetLastError
SetLastErrorEx
Send comments about this topic to Microsoft
Build date: 7/30/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms679360(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 11:24:48