UtilWin32 Class

Contains win32 related utilites.

Definition

Namespace: DevCase.Win32
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
public sealed class UtilWin32
Inheritance
Object    UtilWin32

Remarks

Methods

CallNativeFunctionTResult, TDelegate Executes a function exported in a native dll and returns the result value.
Equals Determines whether the specified object is equal to the current object.
(Inherited from Object)
FailFastIfFalse Evaluates the supplied unmanaged return value and, if it is equal to , immediately terminates the calling process after writing the corresponding Win32 error message to the Windows Application event log.

This exception uses the last Win32 error code (GetLastWin32Error) as error message.

FailFastIfZero(Int32) Evaluates the supplied unmanaged return value and, if it is equal to zero, immediately terminates the calling process after writing the corresponding Win32 error message to the Windows Application event log.

This exception uses the last Win32 error code (GetLastWin32Error) as error message.

FailFastIfZero(IntPtr) Evaluates the supplied unmanaged return value and, if it is equal to Zero, immediately terminates the calling process after writing the corresponding Win32 error message to the Windows Application event log.

This exception uses the last Win32 error code (GetLastWin32Error) as error message.

FailFastIfZero(UInt32) Evaluates the supplied unmanaged return value and, if it is equal to zero, immediately terminates the calling process after writing the corresponding Win32 error message to the Windows Application event log.

This exception uses the last Win32 error code (GetLastWin32Error) as error message.

FailIfFalse Evaluates the supplied unmanaged return value and, if it is equal to , throws the corresponding Win32Exception.

This exception uses the last Win32 error code (GetLastWin32Error) as error message.

FailIfZero(Int32) Evaluates the supplied unmanaged return value and, if it is equal to zero, throws the corresponding Win32Exception.

This exception uses the last Win32 error code (GetLastWin32Error) as error message.

FailIfZero(IntPtr) Evaluates the supplied unmanaged return value and, if it is equal to Zero, throws the corresponding Win32Exception.

This exception uses the last Win32 error code (GetLastWin32Error) as error message.

FailIfZero(UInt32) Evaluates the supplied unmanaged return value and, if it is equal to zero, throws the corresponding Win32Exception.

This exception uses the last Win32 error code (GetLastWin32Error) as error message.

GetHashCode Serves as the default hash function.
(Inherited from Object)
GetHiByte Gets the high-order byte of a WORD value.
GetHiDWord Gets the high-order DWORD of a DWORDLONG value.
GetHiWord(IntPtr) Gets the high-order WORD of a DWORD value.
GetHiWord(UInt32) Gets the high-order WORD of a DWORD value.
GetLoByte Gets the low-order byte of a WORD value.
GetLoDWord Gets the low-order DWORD of a DWORDLONG value.
GetLoWord(IntPtr) Gets the low-order WORD of a DWORD value.
GetLoWord(UInt32) Gets the low-order WORD of a DWORD value.
GetNativeFunctionTDelegate Gets a function exported in a native dll.
GetType Gets the Type of the current instance.
(Inherited from Object)
MakeDWord Creates a (32-Bit Unsigned Integer) DWORD value from a LOWORD and a HIWORD.
MakeDWordLong Creates a (64-Bit Unsigned Integer) DWORDLONG value from a LODWORD and a HIDWORD.
MakeLParam(Int32, Int32) Creates a lParam value from two Int32 values.

You must call this method overload if you need to use negative values.

MakeLParam(UInt16, UInt16) Creates a lParam value from two UInt16 values.

MakeWord Creates a (16-Bit Unsigned Integer) WORD value from a LOBYTE and a HIBYTE.
MakeWParam(Int32, Int32) Creates a wParam value from two Int32 values.

You must call this method overload if you need to use negative values.

MakeWParam(UInt16, UInt16) Creates a wParam value from two UInt16 values.

SafePInvokeT(ExpressionFuncT, Boolean) Invokes a platform invoke encapsulated function, providing a higher safety level for error-handling.

If the function that was called using platform invoke has the SetLastError, then it checks the exit code returned by the function, and, if is not same as successValue, throws the corresponding Win32Exception.

SafePInvokeT(ExpressionFuncT, Int32) Invokes a platform invoke encapsulated function, providing a higher safety level for error-handling.

If the function that was called using platform invoke has the SetLastError, then it checks the exit code returned by the function, and, if is not same as successValue, throws the corresponding Win32Exception.

SetHiByte Sets the high-order byte of an WORD value.
SetHiDword Sets the high-order DWORD of a DWORDLONG value.
SetHiWord Sets the high-order WORD of a DWORD value.
SetLoByte Sets the low-order byte of a WORD value.
SetLoDword Sets the low-order DWORD of an DWORDLONG value.
SetLoWord Sets the low-order WORD of a DWORD value.
UnmanagedTypeToManagedType Translates a value of the UnmanagedType enumeration to an appropriated .NET managed type equivalent.
WindowsGuidToManagedGuid Translates a GUID that is defined in a Windows C++ header file using the DEFINE_GUID macro, to a managed Guid.

Extension Methods

CanConvertTo Determines whether the source object can be converted to the specified target type.
(Defined by ObjectExtensions)
CanConvertToT Determines whether the source object can be converted to the specified target type.
(Defined by ObjectExtensions)
ConvertToT Converts an object to the specified target type.

If the conversion fails, an exception is thrown.
(Defined by ObjectExtensions)

ConvertToT Converts an object to the specified target type.

If the conversion fails, returns the specified default value.
(Defined by ObjectExtensions)

IsDisposable Determines whether the specified object is a disposable type (i.e., it implements IDisposable interface).
(Defined by ObjectExtensions)
Speak Speaks the string representation of the source object by using the operating system integrated text-to-speech synthesizer.
(Defined by ObjectExtensions)
Speak Speaks the string representation of the source object by using the operating system integrated text-to-speech synthesizer.
(Defined by ObjectExtensions)
ThrowIfNullTException Throws the specified exception if the source object is null.
(Defined by ObjectExtensions)

See Also