Volume Control
Application-specific hotkeys for Windows
VolumeControl.Core.Helpers.GetWin32Error Class Reference

Exposes the Win32 FormatMessage & GetLastError functions. More...

Collaboration diagram for VolumeControl.Core.Helpers.GetWin32Error:

Public Types

enum class  FORMAT_MESSAGE : uint {
  ALLOCATE_BUFFER = 0x00000100 , IGNORE_INSERTS = 0x00000200 , FROM_SYSTEM = 0x00001000 , ARGUMENT_ARRAY = 0x00002000 ,
  FROM_HMODULE = 0x00000800 , FROM_STRING = 0x00000400
}
 Possible flags to pass to the FormatMessage(FORMAT_MESSAGE, IntPtr, int, uint, out StringBuilder, int, IntPtr) method. More...
 

Static Public Member Functions

static int GetLastError ()
 Gets the last error to have occurred from within the unmanaged C++ Windows API. More...
 
static string FormatError (int err)
 Gets an error message from the given err HResult.
This is a convenience method that calls FormatMessage(FORMAT_MESSAGE, IntPtr, int, uint, out StringBuilder, int, IntPtr). More...
 
static string GetLastErrorString ()
 Gets the last error message to have occurred from within the unmanaged C++ Windows API, as a string. More...
 

Static Public Attributes

static int hresult
 Gets both the last HResult error ID and the associated string error message for the last error message to have occurred from within the unmanaged C++ Windows API. More...
 

Detailed Description

Exposes the Win32 FormatMessage & GetLastError functions.

Member Enumeration Documentation

◆ FORMAT_MESSAGE

Possible flags to pass to the FormatMessage(FORMAT_MESSAGE, IntPtr, int, uint, out StringBuilder, int, IntPtr) method.

Enumerator
ALLOCATE_BUFFER 
IGNORE_INSERTS 
FROM_SYSTEM 
ARGUMENT_ARRAY 
FROM_HMODULE 
FROM_STRING 

Member Function Documentation

◆ FormatError()

static string VolumeControl.Core.Helpers.GetWin32Error.FormatError ( int  err)
static

Gets an error message from the given err HResult.
This is a convenience method that calls FormatMessage(FORMAT_MESSAGE, IntPtr, int, uint, out StringBuilder, int, IntPtr).

Parameters
errThe HResult error ID to format into a string.
Returns
The string error message associated with HResult err .

◆ GetLastError()

static int VolumeControl.Core.Helpers.GetWin32Error.GetLastError ( )
static

Gets the last error to have occurred from within the unmanaged C++ Windows API.

Returns
An int representing the HResult of the last error.

◆ GetLastErrorString()

static string VolumeControl.Core.Helpers.GetWin32Error.GetLastErrorString ( )
static

Gets the last error message to have occurred from within the unmanaged C++ Windows API, as a string.

Returns
A string error message.

Member Data Documentation

◆ hresult

int VolumeControl.Core.Helpers.GetWin32Error.hresult
static

Gets both the last HResult error ID and the associated string error message for the last error message to have occurred from within the unmanaged C++ Windows API.

Returns
HResult and string error message as a tuple.

The documentation for this class was generated from the following file: