Desktop Functions: Smart Device Functions:
|
Search Results for "HRESULT" in [All]shlwapiReturns an HRESULT. Returns an HRESULT; S_FALSE indicates that the path specified was already in Url format and was copied unchanged to url. urlmon
// This version maps HRESULT to exception: ole32// Note: PreserveSig=false allows .NET interop to handle processing the returned HRESULT and throw an exception on failure I find it better to turn off [PreserveSig] for methods that return an HRESULT and have a trailing out parameter, providing that the HRESULT does not have more that one success code (typically S_OK only). This results in a slightly cleaner syntax where the out parameter becomes the return value and a failing HRESULT results in an exception. I find it better to turn off [PreserveSig] for methods that return an HRESULT and have a trailing out parameter, providing that the HRESULT does not have more that one success code (typically S_OK only). This results in a slightly cleaner syntax where the out parameter becomes the return value and a failing HRESULT results in an exception. I find it better to turn off [PreserveSig] for methods that return an HRESULT and have a trailing out parameter, providing that the HRESULT does not have more that one success code (typically S_OK only). This results in a slightly cleaner syntax where the out parameter becomes the return value and a failing HRESULT results in an exception. user3210: CreatePopupMenu
public class BatchResultContextMenu: IShellExtInit, IContextMenu
bool done = ProcessBatchResults();
bool ProcessBatchResults()
rk.SetValue(guid.ToString(), "BatchResults shell extension");
// Set "Folder\\shellex\\ContextMenuHandlers\\BatchResults" regkey to my guid
rk = root.CreateSubKey("POPUPTEST\\shellex\\ContextMenuHandlers\\BatchResults");
root.DeleteSubKey("POPUPTEST\\shellex\\ContextMenuHandlers\\BatchResults"); Enums11: HRESULT
enum HRESULT : long Yet another one HRESULT. It should pretty look in the Debug/Watch tab of the MVS>=2005
#region HRESULT
public struct HRESULT :
,System.IEquatable<HRESULT>
,System.IComparable<HRESULT>
public class HResultException : System.SystemException
new public HRESULT HResult
get { return new HRESULT(base.HResult); }
set { base.HResult = value.m_value; }
public HResultException(int hr)
: base((new HRESULT(hr)).ToString())
base.HResult = hr;
return new HResultException(hr);
public HRESULT(int value)
public static implicit operator int(HRESULT This)
public static implicit operator HRESULT(int This)
return new HRESULT(This);
public static implicit operator bool(HRESULT This)
public static bool operator true(HRESULT This)
public static bool operator false(HRESULT This)
public bool Equals(HRESULT that)
if (obj is HRESULT)
return Equals((HRESULT)obj);
public int CompareTo(HRESULT that)
if (obj is HRESULT)
return CompareTo((HRESULT)obj);
throw new System.ArgumentException("Arg_MustBeHRESULT");
//Find what: ^{:b*}//:b*\n:b*\#define:b+{:i}:b+(_HRESULT_TYPEDEF_)\({0x:h}L\)
//Find what: ^{:b*}//:b*\n:b*//:b*(MessageId\::b*:i):b*\n(:b*//:b*\n)+:b*//:b*MessageText\::b*\n(:b*//:b*\n)*:b*//:b*{.*}\n(:b*//:b*\n)+:b*\#define:b+{:i}:b+(_HRESULT_TYPEDEF_)\({0x:h}L\)
static HRESULT()
System.Reflection.FieldInfo[] fieldsInfo = typeof(HRESULT).GetFields(System.Reflection.BindingFlags.Public|System.Reflection.BindingFlags.Static);
#endregion HRESULT
Enum HRESULT
#Region "HRESULT"
Public Structure HRESULT
Implements System.IEquatable(Of HRESULT)
Implements System.IComparable(Of HRESULT)
Public Class HResultException
Public Shadows Property HResult() As HRESULT
Return New HRESULT(MyBase.HResult)
MyBase.HResult = value.m_value
MyBase.New((New HRESULT(hr)).ToString())
MyBase.HResult = hr
Return New HResultException(hr)
Public Shared Widening Operator CType(This As HRESULT) As Integer
Public Shared Widening Operator CType(This As Integer) As HRESULT
Return New HRESULT(This)
Public Shared Widening Operator CType(This As HRESULT) As Boolean
Public Shared Operator IsTrue(This As HRESULT) As Boolean
Public Shared Operator IsFalse(This As HRESULT) As Boolean
Public Overloads Function Equals(that As HRESULT) As Boolean
If TypeOf obj Is HRESULT Then
Return Equals(CType(obj, HRESULT))
Public Function CompareTo(that As HRESULT) As Integer
If TypeOf obj Is HRESULT Then
Return CompareTo(CType(obj, HRESULT))
Throw New System.ArgumentException("Arg_MustBeHRESULT")
'Find what: ^{:b*}//:b*\n:b*\#define:b+{:i}:b+(_HRESULT_TYPEDEF_)\({0x:h}L\)
'Find what: ^{:b*}//:b*\n:b*//:b*(MessageId\::b*:i):b*\n(:b*//:b*\n)+:b*//:b*MessageText\::b*\n(:b*//:b*\n)*:b*//:b*{.*}\n(:b*//:b*\n)+:b*\#define:b+{:i}:b+(_HRESULT_TYPEDEF_)\({0x:h}L\)
Dim fieldsInfo As System.Reflection.FieldInfo() = GetType(HRESULT).GetFields(System.Reflection.BindingFlags.[Public] Or System.Reflection.BindingFlags.[Static]) 12: VARENUM
VT_HRESULT = 25, msdrmHRESULT difxapi
Int32 GetPathResult = DriverPackageGetPath(infFile, infDriverStorePath, out infDriverStorePathLength);
if (GetPathResult == ERROR_INSUFFICIENT_BUFFER)
GetPathResult = DriverPackageGetPath(infFile, infDriverStorePath, out infDriverStorePathLength);
Dim GetPathResult As Int32 = DriverPackageGetPath(infFile, infDriverStorePath, infDriverStorePathLength)
If GetPathResult = ERROR_INSUFFICIENT_BUFFER Then
GetPathResult = DriverPackageGetPath(infFile, infDriverStorePath, infDriverStorePathLength) shell3215: ITaskbarList
HResult ThumbBarAddButtons(
HResult ThumbBarUpdateButtons(
Function ThumbBarAddButtons(hwnd As IntPtr, cButtons As UInteger, <MarshalAs(UnmanagedType.LPArray)> pButtons As ThumbButton()) As HResult
Function ThumbBarUpdateButtons(hwnd As IntPtr, cButtons As UInteger, <MarshalAs(UnmanagedType.LPArray)> pButtons As ThumbButton()) As HResult 16: ITaskbarList4
HResult ThumbBarAddButtons(
HResult ThumbBarUpdateButtons( 17: Shell_NotifyIcon
var hresult = Shell_NotifyIconGetRect(ref notifyIcon, out rect);
if (hresult == 0x80004005)
throw new Win32Exception(hresult, "Failed to get icon position.");
if (hresult != 0)
throw new Win32Exception(hresult);
var hresult = Shell_NotifyIconGetRect(ref notifyIcon, out rect);
if (hresult == 0x80004005)
throw new Win32Exception(hresult, "Failed to get icon position.");
if (hresult != 0)
throw new Win32Exception(hresult);
int hresult = SHEmptyRecycleBin(IntPtr.Zero, rootPath,
System.Diagnostics.Debug.Write(hresult);
int hresult = SHQueryRecycleBin(string.Empty, ref sqrbi);
int hresult = SHQueryRecycleBin(@"C:\", ref sqrbi); Constants21: PROPERTYKEY
public static PropertyKey WPD_PROPERTY_COMMON_HRESULT = new PropertyKey(0xF0422A9C, 0x5DC8, 0x4440, 0xB5, 0xBD, 0x5D, 0xF2, 0x88, 0x35, 0x65, 0x8A, 1003);
public static PropertyKey WPD_PROPERTY_SERVICE_METHOD_HRESULT = new PropertyKey(0x2D521CA8, 0xC1B0, 0x4268, 0xA3, 0x42, 0xCF, 0x19, 0x32, 0x15, 0x69, 0xBC, 1005); 22: WINERROR
/// An HRESULT could not be translated to a corresponding Win32 error code.
public const int ERROR_SXS_UNTRANSLATABLE_HRESULT = 14077; msi23: MsiFormatRecord
[Out] StringBuilder szResultBuf, ref int pcchResultBuf); mscorsnThe results of this function are an HRESULT that can be translated with [Marshal.GetExceptionForHR] and [Marshal.ThrowExceptionForHR] comctl3225: TaskDialog
static extern HRESULT TaskDialogIndirect
Private Shared Function TaskDialogIndirect(<[In]> pTaskConfig As TASKDIALOGCONFIG, <Out> ByRef pnButton As Integer, <Out> ByRef pnRadioButton As Integer, <MarshalAs(UnmanagedType.Bool), Out> ByRef pfverificationFlagChecked As Boolean) As HRESULT
static extern HRESULT TaskDialogIndirect
Private Shared Function TaskDialogIndirect(<[In]> pTaskConfig As TASKDIALOGCONFIG, <Out> ByRef pnButton As Integer, <Out> ByRef pnRadioButton As Integer, <MarshalAs(UnmanagedType.Bool), Out> ByRef pfverificationFlagChecked As Boolean) As HRESULT rapi27: CeFindNextFile
int hResult = CeFindFirstFile("\\temp\\*", ref findData);
if(hResult != -1)
}while(CeFindNextFile(hResult, ref findData));
CeFindClose(hResult); 28: CeRapiInit HRESULT translates to void (NOT int or anything else some idiot has written down) for c# function prototypes. Any HRESULT other than "OK" will cause the runtime to throw an exception. 29: CeRapiInitEx HRESULT translates to void (NOT int or anything else some idiot has written down) for c# function prototypes. Any HRESULT other than "OK" will cause the runtime to throw an exception. 30: CeRapiInvoke int hResult = CeRapiInvoke(sDllPath, sFunction, 0, IntPtr.Zero, out uiOutput, out pOutput, IntPtr.Zero, 0); if ( hResult != 0 ) uxtheme31: OpenThemeFile
Function OpenThemeFile(pszThemeFileName: LPCWSTR; pszColorName: LPCWSTR; pszSizeName: LPCWSTR; hThemeFile: Pointer; unknown: DWORD): HRESULT; StdCall; External 'uxtheme.dll' Index 2; 32: SetWindowTheme Returns HRESULT. Returns HRESULT. Structures34: RAPIINIT HRESULT is void as a function return type, or int as a struct variable or function parameter. Beware! kernel32ThrowExceptionForHR is for HRESULT values returned directly from NT functions, is it not? 36: FormatMessage ThrowExceptionForHR is for HRESULT values returned directly from NT functions, is it not? 37: GetProcAddress
typedef HRESULT (STDAPICALLTYPE * LPFNTEST) (void); userenv38: CreateProfile
int hResult = CreateProfile(i.Owner.Value, username, s, c); Interfaces
[In, MarshalAs(UnmanagedType.Error)] uint hresult,
public enum HRESULTS :long
public void OnStopBinding (uint hresult , string szError )
if( hresult == 1)
OnDownloadAborted(SourcePath,hresult, ErrorDescription(hresult));
switch((HRESULTS)ErrNum)
case HRESULTS.INET_E_AUTHENTICATION_REQUIRED:
case HRESULTS.INET_E_CANNOT_CONNECT:
case HRESULTS.INET_E_CANNOT_INSTANTIATE_OBJECT:
case HRESULTS.INET_E_CANNOT_LOAD_DATA:
case HRESULTS.INET_E_CANNOT_LOCK_REQUEST:
case HRESULTS.INET_E_CANNOT_REPLACE_SFP_FILE:
case HRESULTS.INET_E_CODE_DOWNLOAD_DECLINED:
case HRESULTS.INET_E_CONNECTION_TIMEOUT:
case HRESULTS.INET_E_DATA_NOT_AVAILABLE:
case HRESULTS.INET_E_DEFAULT_ACTION:
case HRESULTS.INET_E_DOWNLOAD_FAILURE:
case HRESULTS.INET_E_INVALID_REQUEST:
case HRESULTS.INET_E_INVALID_URL:
case HRESULTS.INET_E_NO_SESSION:
case HRESULTS.INET_E_NO_VALID_MEDIA:
case HRESULTS.INET_E_OBJECT_NOT_FOUND:
case HRESULTS.INET_E_QUERYOPTION_UNKNOWN:
case HRESULTS.INET_E_REDIRECT_FAILED:
case HRESULTS.INET_E_REDIRECT_TO_DIR:
case HRESULTS.INET_E_RESOURCE_NOT_FOUND:
case HRESULTS.INET_E_RESULT_DISPATCHED:
case HRESULTS.INET_E_SECURITY_PROBLEM:
case HRESULTS.INET_E_UNKNOWN_PROTOCOL: Note that Next() can return both S_OK and S_FALSE so the HRESULT return code must be preserved. 41: IFileDialog
// the proper HRESULT
HRESULT OnFileOk ( [In, MarshalAs ( UnmanagedType.Interface )] IFileDialog pfd );
HRESULT OnFolderChanging ( [In, MarshalAs ( UnmanagedType.Interface )] IFileDialog pfd,
// the proper HRESULT
HRESULT OnFileOk ( [In, MarshalAs ( UnmanagedType.Interface )] IFileDialog pfd );
HRESULT OnFolderChanging ( [In, MarshalAs ( UnmanagedType.Interface )] IFileDialog pfd, 43: IPersistFile
ByVal dwMode As STGM) As HRESULT
<MarshalAs(UnmanagedType.Bool)> ByVal fRemember As Boolean) As HRESULT
<PreserveSig()> Function SaveCompleted(<MarshalAs(UnmanagedType.LPWStr)> ByVal pszFileName As String) As HRESULT
<PreserveSig()> Function GetCurFile(<MarshalAs(UnmanagedType.LPWStr)> ByVal ppszFileName As Text.StringBuilder) As HRESULT 44: IProgressDialog
[PreserveSig] //yes the only method with PreserveSig, every other method returns an HRESULT To preserve HRESULT return values, the PreserveSig attribute is needed. An alternate signature would omit PreserveSig and return void. With that signature, the interop marshaler would convert failure HRESULT values to COMException. 46: IShellFolder
/// successful, the CODE field of the HRESULT contains one of the
/// GetHResultCode): Negative A negative return value indicates that the first item should precede the second (pidl1 < pidl2). 47: IShellLinkW
ByVal fFlags As Integer) As HRESULT
<PreserveSig()> Function GetIDList(ByRef ppidl As IntPtr) As HRESULT
<PreserveSig()> Function SetIDList(ByVal pidl As IntPtr) As HRESULT
ByVal cch As Integer) As HRESULT
<MarshalAs(UnmanagedType.LPWStr)> ByVal pszName As String) As HRESULT
ByVal cch As Integer) As HRESULT
<MarshalAs(UnmanagedType.LPWStr)> ByVal pszDir As String) As HRESULT
ByVal cch As Integer) As HRESULT
<MarshalAs(UnmanagedType.LPWStr)> ByVal pszArgs As String) As HRESULT
<PreserveSig()> Function GetHotkey(ByRef pwHotkey As Short) As HRESULT
<PreserveSig()> Function SetHotkey(ByVal wHotkey As Short) As HRESULT
<PreserveSig()> Function GetShowCmd(ByRef piShowCmd As Integer) As HRESULT
<PreserveSig()> Function SetShowCmd(ByVal iShowCmd As Integer) As HRESULT
ByRef piIcon As Integer) As HRESULT
ByVal iIcon As Integer) As HRESULT
ByVal dwReserved As Integer) As HRESULT
<PreserveSig()> Function Resolve(ByVal hwnd As IntPtr, ByVal fFlags As Integer) As HRESULT
<MarshalAs(UnmanagedType.LPWStr)> ByVal pszFile As String) As HRESULT 48: ITfLangBarMgr
///virtual HRESULT STDMETHODCALLTYPE AdviseEventSink(
///virtual HRESULT STDMETHODCALLTYPE UnadviseEventSink(
///virtual HRESULT STDMETHODCALLTYPE GetThreadMarshalInterface(
///virtual HRESULT STDMETHODCALLTYPE GetThreadLangBarItemMgr(
///virtual HRESULT STDMETHODCALLTYPE GetInputProcessorProfiles(
///virtual HRESULT STDMETHODCALLTYPE RestoreLastFocus(
///virtual HRESULT STDMETHODCALLTYPE SetModalInput(
///virtual HRESULT STDMETHODCALLTYPE ShowFloating(
///virtual HRESULT STDMETHODCALLTYPE GetShowFloatingStatus( 49: ITravelLogStg
if ((oret == IntPtr.Zero) || (hr != Hresults.S_OK))
for (int i = 0; Hresults.S_OK == hr; i++) 50: IUIApplication
HRESULT OnViewChanged(UInt32 viewId,
HRESULT OnCreateUICommand(UInt32 commandId,
HRESULT OnDestroyUICommand(UInt32 commandId, 51: IUICollection
HRESULT OnChanged(UI_CollectionChange action,
HRESULT Execute(UInt32 commandId, // the command that has been executed
HRESULT UpdateProperty(UInt32 commandId, 53: IUIContextualUI
HRESULT ShowAtLocation(Int32 x, Int32 y); 54: IUIFramework
HRESULT Initialize(IntPtr frameWnd, IUIApplication application);
HRESULT Destroy();
HRESULT LoadUI(IntPtr instance, [MarshalAs(UnmanagedType.LPWStr)] string resourceName);
HRESULT GetView(UInt32 viewId, Guid riid, [Out(), MarshalAs(UnmanagedType.Interface)] out object /* [out, iid_is(riid), annotation("__deref_out")] void** */ ppv);
HRESULT GetUICommandProperty(UInt32 commandId, [In] ref PropertyKey key, out PropVariant value);
HRESULT SetUICommandProperty(UInt32 commandId, [In] ref PropertyKey key, [In] ref PropVariant value);
HRESULT InvalidateUICommand(UInt32 commandId, UI_Invalidations flags, [In] ref PropertyKey key);
HRESULT FlushPendingInvalidations();
HRESULT SetModes(Int32 iModes); 55: IUIImage
HRESULT CreateImage(IntPtr /* HBITMAP */ bitmap, UI_Ownership options, [Out(), MarshalAs(UnmanagedType.Interface)] out IUIImage image); 56: IUIRibbon
HRESULT GetHeight(out UInt32 cy);
HRESULT LoadSettingsFromStream([MarshalAs(UnmanagedType.Interface)] IStream pStream);
HRESULT SaveSettingsToStream([MarshalAs(UnmanagedType.Interface)] IStream pStream);
HRESULT GetValue([In] ref PropertyKey key, [Out()] out PropVariant value); coredll
59: SipShowIM Main benefit of using this over the InputPanel is that there is no control to instantiate in the form initialization process. The main drawback is that you do not have access to the InputPanel.Bounds property. C++ TRUE indicates success. When this function fails, it returns an HRESULT error code. oleaut3260: GetActiveObject
// Returns a raw HRESULT:
// Converts failure HRESULTs to exceptions: Cut off search results after 60. Please refine your search. |