Ler em inglês Editar

Compartilhar via


ErrObject.LastDllError Property

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Gets a system error code produced by a call to a dynamic-link library (DLL).

C#
public int LastDllError { get; }
C#
public int LastDllError { [System.Security.SecurityCritical] get; }

Property Value

A system error code produced by a call to a dynamic-link library (DLL).

Attributes

Examples

The following example shows how you can use the LastDllError property after calling a function in the Windows API. The PrintWindowCoordinates procedure takes a handle to a window and calls the GetWindowRect function. GetWindowRect fills the RECT data structure with the lengths of the sides of the rectangle that make up the window. If you pass an invalid handle, an error occurs, and the error number is available through the LastDllError property.

VB
Declare Function GetWindowRect Lib "user32" (
    ByVal hwnd As Integer, ByRef lpRect As RECT) As Integer

Remarks

The LastDllError property applies only to DLL calls made from Visual Basic code. When such a call is made, the called function usually returns a code indicating success or failure, and the LastDllError property is filled. Check the documentation for the DLL's functions to determine the return values that indicate success or failure. Whenever the failure code is returned, the Visual Basic application should immediately check the LastDllError property. No exception is raised when the LastDllError property is set.

Observação

For smart devices, this property always returns zero.

Applies to

Produto Versões
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also