hresult

Get more debug info from AxHost?

Hello I'm trying to deploy an application which uses an library that embeds an ActiveX control with AxHost in C#. When I run the installed app on our test rig I catch and present the following exception: Unexpected exception. This application has failed to start because the application configuration is incorrect. Reinstalling the app...

How should I check that [out] params in COM can be used?

Officially one should not use [out] parameters from COM functions unless the function succeeded this means that there are (at least) three ways to see if an [out] parameter can be used. Consider the following interface interface IFoo : IUnknown { HRESULT GetOtherFoo([out] IFoo** ppFoo); HRESULT Bar(); }; Which of the follow...

How do I determine the HResult for a System.IO.IOException?

The System.Exception.HResult property is protected. How can I peek inside an exception and get the HResult without resorting to reflection or other ugly hacks? Here's the situation: I want to write a backup tool, which opens and reads files on a system. I open the file with FileAccess.Read and FileShare.ReadWrite, according to this...

Compiler not flagging incorrect return value for HRESULT

I just spent way too long trying to diagnose why, in the following snippet of code, the ProcessEvent() method seemed to be ignoring the false value I passed in for aInvokeEventHandler: HRESULT CEventManager:: Process(Event anEvent) { return (m_pPool->GetFsm()->ProcessEvent(anEvent), false); } // Definition of ProcessEvent() HRESUL...

SharePoint error whan adding user as site owner.

Hi there. I have a MOSS 2007 site which I'm an admin for. In the 'People and Groups' area for a site, I'm trying to add a user as a site owner. On the 'Add User' page, I add the name of the user and click 'OK', after which I get this totally useless error: Exception from HRESULT: 0x80040E37 at Microsoft.SharePoint.Library.SPRequ...

Creating your own HRESULT?

I already have a project that uses alot of COM, and HRESULTS. ANyways i was wondering if its possible to define your own HRESULT, AND be able to use the FormatMessage() for our own HRESULT? I dug around and cant find anything. Any ideas? EDIT Basically i want to define a set of my own HRESULT's instead of just returning E_FAIL. Or one...

Working with HResult, interop and related things in C#

Hi guys, 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 the Windows API. I am starting to learn but at times it can be hard to find very...

Error while using Keyword Query object in asp.net application for search in sharepoint.

I am trying to use Keyword Query object in asp.net application. I wrote this code : Namespace : using System.Data.SqlClient; using Microsoft.SharePoint; using Microsoft.SharePoint.Search; using Microsoft.SharePoint.Search.Query; Page load event: GridView grd = new GridView(); ...

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 mean, and where should I start in diagnosing this? ...

Silverlight ChildWindow: HRESULT E_FAIL on ChildWindow.Show()

Hello, I have some problems with ChildWindow control, I have created an error window control that is shown after unhandled exception is caught in app.xaml.cs. The problem is when I try to show the error window, sometimes it works fine, but sometimes I get this nasty exception: Message: Error HRESULT E_FAIL has been returned from a cal...

Explaining the declaration/definition of HRESULT

I just looked at the definition of HRESULT in VS2008. WinNT.h has the following line: typedef __success(return >= 0) long HRESULT; What exactly does it mean? It doesn't even look like C or C++ to my untrained eye ...

Microsoft.Office.Interop.Graph.Chart

I am trying to generate a powerpoint presentation in C#. Everything works well on my machine but when I deploy it on Server I receive HRESULT exception on the creation of chart. Tables and other shapes work on both sides but I dont whats wrong with the chart when I generate it on Server. Can someone help here? ...

The located assembly's manifest definition does not match the assembly

Hi Guys, Im getting the error below when i try to build my web app. the same code work on my other machine, but not in the main dev. i have the dll in the bin folder, too. and the error discription is nothing more than the one given below? any ideas whats going on ? Could not load file or assembly 'Microsoft.Office.Interop.PowerPoint12...

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 negative value. I could have used bools, but that would break the existing pattern (usually th...

HRESULT exception not caught in VS 2008

Hello all, I've got a stange situation in visual studio 2008 C++. I work on code that was originally written for visual studio 2003, where everything works well. Now, ported to VS 2008, the exception handling, which unfortuantely exists widely in the code, does not work anymore. standard code example: try { HRESULT hr = S_OK; ...

Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

Hi all , I'm trying to parse HTML page usging Microsoft.mshtml . I get an exception : Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) Any idea how to resolve this problem . Thanks in advance ... ...

How do I get HRESULT returns from libraries imported to c# with tlbimp.exe?

I am using the GMFBridge directshow filter from c# and the import library seems to discard the HRESULTs. i.e [id(5), helpstring("Create render filters in empty render graph")] HRESULT CreateRenderGraph( [in] IUnknown* pSourceGraphSinkFilter, [in] IUnknown* pRenderGraph, [out, retval] IUnknown** pRenderGraphSourceFilter); [id(6), ...

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 HRESULT (the problem is compound by the fact that S_OK == false). Is there a way to det...

Passing HRESULT as a string on command line

I have a need to pass in an HRESULT value to a program as a command line argument. I had intended to do so by passing the hex value, e.g.: >receiver.exe 0x80048836 I'm trying to convert this string representation back into an HRESULT using wcstol, eg: HRESULT hr = wcstol(argv[2], NULL, 16); However, the value of the original HRESUL...