HRESULT is used as a return value to determine the success or failure of a function.
Questions tagged [hresult]
168 questions
3
votes
1 answer
Detecting the use of HRESULTs as bools
We have a big body of code that was refactored so that stuff which was plain-old C++ is now COM.
I've been spending the last couple of days hunting out places in which we missed the fact that a function that previously returned a bool now returns an…

Motti
- 110,860
- 49
- 189
- 262
3
votes
2 answers
C# Multithreaded Access on Excel File
I'm coding on an multithreaded C# Application which provides some statistics for an Excel File.
I opened the File by following Code:
private static Excel.Application excelApp = new Excel.Application();
private static Excel.Workbook workbook…

P. Edge
- 105
- 1
- 7
3
votes
2 answers
Setting specific COM HRESULT value from .NET
I'm creating a .NET assembly that needs to be COM callable from e.g. VB6 etc.
Most of the stuff works fine - I'm fine-tuning my error handling right now.
What I'd like to do is create specific HRESULT values for my exceptions - e.g. use values like…

marc_s
- 732,580
- 175
- 1,330
- 1,459
3
votes
0 answers
HRESULT = 0x80131902 when using Ischeduler.connect
I'm trying to connect to a windows HPC using C++ with code I lifted from https://msdn.microsoft.com/en-us/library/cc853425(v=vs.85).aspx
on a test project all worked well, but when i tried to copy paste to my main project i started getting…

Eyal
- 161
- 1
- 9
3
votes
3 answers
Visual Studio 2013 Error Message: 0x80004001 (E_NOTIMPL)
For some reason, Microsoft Visual Studio 2013 keeps giving me the following error:
Not implemented (Exception from HRESULT: x080004001 (E_NOTIMPL))
I receive this error when attempting to make a new SQL table. The way I reproduce this error is…

Gabriel Graves
- 1,751
- 1
- 22
- 40
3
votes
1 answer
Azure ADAL (version 2.14) AcquireToken error
I am able to authenticate a user when working locally, using the line
AuthenticationResult result = context.AcquireToken(resource,clientID, returnURI, PromptBehavior.Always);
Locally, I get the signin screen and the UserInfo.
When I publish the web…

Sam Dzirasa
- 63
- 5
3
votes
4 answers
Which HRESULT literal constant will fail the SUCCEEDED() macro?
Definition of SUCCEEDED(): #define SUCCEEDED(hr) (((HRESULT)(hr)) >= 0)
Background: When an Ok button is clicked on a dialog, I need to return an HRESULT value hr such that SUCCEEDED(hr) is true. If Cancel button is clicked, I need to return a…

Hamish Grubijan
- 10,562
- 23
- 99
- 147
3
votes
1 answer
IOException HResult possible values
I find out that sometimes in IO operations common IOException is thrown. I can use Marshal.GetHRForException(Exception e) method (found here) in order to determine the specific error code. After that, I want to re-throw an exception, using my…

stukselbax
- 5,855
- 3
- 32
- 54
3
votes
1 answer
How to convert HRESULT into an error description?
Say, if I have a WinAPI that fails with an HRESULT code. Is there a way to convert it to an error description string?

c00000fd
- 20,994
- 29
- 177
- 400
3
votes
4 answers
What does ERROR_DLL_INIT_FAILED mean?
I'm seeing the following exception in my managed (C#) app calling an unmanaged assembly:
Caught:System.IO.FileLoadException 'A dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A)'
What does this HRESULT…

Justin
- 84,773
- 49
- 224
- 367
3
votes
2 answers
Working with HResult, interop and related things in C#
I am working on a project in C# to create a forms application. I would like to use IFileDialog and other functionality that is part of the native Windows API (or however ti should be called).
Starting out I knew absolutely nothing about interop or…

Kris
- 2,100
- 5
- 31
- 50
3
votes
3 answers
Checking the return value from a method for an HRESULT of S_OK
How can I compare the value returned from a method with HRESULT? I tried this but it is not working:
FPropStg.DeleteMultiple(1, psProp) == VSConstants.S_OK
The type defintion for DeleteMultiple() is:
HRESULT IPropertyStorage.DeleteMultiple(Ulong,…

saumil patel
- 247
- 5
- 16
2
votes
1 answer
VarCmp returning 0x80020008 (Bad variable type)
I'm trying to compare two VARIANT values in VC++ using the VarCmp function:
VARIANT a;
VariantInit(&a);
a.vt = VT_UINT;
a.uintVal = 32;
VARIANT b;
VariantInit(&b);
b.vt = VT_UINT;
b.uintVal = 32;
HRESULT hr = VarCmp(&a, &b,…

sourcenouveau
- 29,356
- 35
- 146
- 243
2
votes
1 answer
C# Webbrowser Control weBrowser.Navigate fails on long URL
For some reason when I try to perform a navigate to a long URL:
webBrowser.Navigate(Url, "_self", null, "Referer: " + Referer);
I get the following error:
Error HRESULT E_FAIL has been returned from a call to a COM component.
The ErrorCode…

user1040700
- 61
- 1
- 4
2
votes
1 answer
What causes CORDBG_E_CLASS_NOT_LOADED (HRESULT: 0x80131303)
While attempting to debug an application, I keep noticing that two of my arrays and one of my lists seems to be mysteriously... Not there. The error given for that (upon pausing the application and looking through my compiler's variable list) is "A…

Edward Black
- 250
- 2
- 10