Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Support Forum
Download Visual Studio Add-In

Terms of Use
Privacy Policy

Search Results for "HRESULT" in [All]

rapi

.

int hResult = CeFindFirstFile("\\temp\\*", ref findData);

.

if(hResult != -1)

.

    }while(CeFindNextFile(hResult, ref findData));

.

    CeFindClose(hResult);

.

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.

.

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.

.

int hResult = CeRapiInvoke(sDllPath, sFunction, 0, IntPtr.Zero, out uiOutput, out pOutput, IntPtr.Zero, 0);

.

if ( hResult != 0 )

Structures

.

HRESULT is void as a function return type, or int as a struct variable or function parameter. Beware!

Enums

.

enum HRESULT : uint

.

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 As UInt32

.

#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])

.
Documentation
[HRESULT] on MSDN
.

        VT_HRESULT = 25,

msdrm

.

HRESULT

user32

.

    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");

comctl32

.

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

.

public delegate HRESULT TaskDialogCallbackProc([In] IntPtr hwnd, [In] TaskDialogNotification msg, [In] IntPtr wParam, [In] IntPtr lParam, [In] IntPtr refData);

.

    <Out> ByRef pnRadioButton As Integer,   <MarshalAs(UnmanagedType.Bool), Out> ByRef pfverificationFlagChecked As Boolean) As HRESULT

dwmapi

.

The return value type DWMAPI is just a uint, you can replace it with HRESULT as well.

Constants

.

    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);

.

        /// An HRESULT could not be translated to a corresponding Win32 error code.

.

        public const int ERROR_SXS_UNTRANSLATABLE_HRESULT = 14077;

ole32

.

// Note: PreserveSig=false allows .NET interop to handle processing the returned HRESULT and throw an exception on failure

.
Summary
Marshals an HRESULT to the specified stream
.

static extern void CoMarshalHresult(UCOMIStream pStm, int hresult);

.
Documentation
[CoMarshalHresult] on MSDN
.
Summary
Unmarshals an HRESULT type from the specified stream
.

static extern int CoUnmarshalHresult(UCOMIStream pStm);

.
Documentation
[CoUnmarshalHresult] on MSDN
.

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.

kernel32

.

ThrowExceptionForHR is for HRESULT values returned directly from NT functions, is it not?

.

ThrowExceptionForHR is for HRESULT values returned directly from NT functions, is it not?

.

typedef HRESULT (STDAPICALLTYPE * LPFNTEST) (void);

oleaut32

.

// Returns a raw HRESULT:

.

// Converts failure HRESULTs to exceptions:

.

In C# The first signature returns the raw HRESULT. The second signature throws an exception when a failure HRESULT is returned.

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)

shlwapi

.

Returns an HRESULT.

.

Returns an HRESULT; S_FALSE indicates that the path specified was already in Url format and was copied unchanged to url.

coredll

.
HRESULT Int32 or UInt32
.

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.

urlmon

.

// This version maps HRESULT to exception:

shell32

.

     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

.

     HResult ThumbBarAddButtons(

.

     HResult ThumbBarUpdateButtons(

.

        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);

mscorsn

.

The results of this function are an HRESULT that can be translated with [Marshal.GetExceptionForHR] and [Marshal.ThrowExceptionForHR]

userenv

.

        int hResult = CreateProfile(i.Owner.Value, username, s, c);

msi

.

   [Out] StringBuilder szResultBuf, ref int pcchResultBuf);

uxtheme

.

Function OpenThemeFile(pszThemeFileName: LPCWSTR; pszColorName: LPCWSTR; pszSizeName: LPCWSTR; hThemeFile: Pointer; unknown: DWORD): HRESULT; StdCall; External 'uxtheme.dll' Index 2;

.

Returns HRESULT.

.

Returns HRESULT.

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.

.

    // 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,

.

            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

.

        [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.

.

    /// 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).

.

            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

.

      ///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(

.

        if ((oret == IntPtr.Zero) || (hr != Hresults.S_OK))

.

        for (int i = 0; Hresults.S_OK == hr; i++)

.

     HRESULT OnViewChanged(UInt32 viewId,

.

     HRESULT OnCreateUICommand(UInt32 commandId,

.

     HRESULT OnDestroyUICommand(UInt32 commandId,

.

     HRESULT OnChanged(UI_CollectionChange action,

.

     HRESULT Execute(UInt32 commandId,              // the command that has been executed

.

     HRESULT UpdateProperty(UInt32 commandId,

.

     HRESULT ShowAtLocation(Int32 x, Int32 y);

.

     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);

.

    HRESULT CreateImage(IntPtr /* HBITMAP */ bitmap, UI_Ownership options, [Out(), MarshalAs(UnmanagedType.Interface)] out IUIImage image);

.

     HRESULT GetHeight(out UInt32 cy);

.

     HRESULT LoadSettingsFromStream([MarshalAs(UnmanagedType.Interface)] IStream pStream);

.

     HRESULT SaveSettingsToStream([MarshalAs(UnmanagedType.Interface)] IStream pStream);

Cut off search results after 60. Please refine your search.


 
Access PInvoke.net directly from VS: