hresult

Excel Exception from HRESULT: 0x800A03EC when writing to a Excel cell

≯℡__Kan透↙ 提交于 2019-12-14 03:14:31
问题 I know that this has been discussed here, but I can not find solution. I am getting this error while working with Microsoft.Office.Interop.Excel in C# (Exception from HRESULT: 0x800A03EC). Here is my code: for (int i = 1; i <= max; i++) { int column = 1 ... double averageDistance = sum / distanceCount; //sum and distanceCount are type double myWorksheet1.Cells[i, column] = averageDistance; // Here I am getting the exception. column++; ... } I know that some people solved this using non-zero

What does this macro do? __success(return >= 0) long

倖福魔咒の 提交于 2019-12-13 14:43:20
问题 In the Windows header file WinNT.h, HRESULT is defines as follows: typedef __success(return >= 0) long HRESULT; Doing some research I learned that the "__success" macro is part of the Microsoft source code annotation language SAL and is defined in sal.h . But for the life of me I can't figure out what it does or how it does it. Thanks in advance. Todd 回答1: This blog post on MSDN explains exactly what __success means: it indicates that a function succeeded if it returns a HRESULT value >= 0.

How do I make catching generic IOExceptions reliably portable across platforms?

折月煮酒 提交于 2019-12-11 07:06:10
问题 I was trying to make the below code work on .NET Standard 1.5, which implies it should be portable across all platforms .NET Standard 1.5 supports. try { channel = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite); } catch (IOException e) when ((e.HResult & 0xFFFF) == 0x00000020) // ERROR_SHARING_VIOLATION { // no failure reason to be recorded, since this is the expected error if a lock exists } catch (IOException e) { FailureReason = e; } catch

Type mismatch on excel data from powershell

[亡魂溺海] 提交于 2019-12-08 05:57:43
问题 Good day everyone. I am a starting programmer in powershell and am trying to make a program input help desk calls into an excel sheet to import into the help desk ticketing system. My script: $excel_file_path = 'G:\IT\Helpdesk\Daily Calls.xlsx' ## Instantiate the COM object $Excel = New-Object -ComObject Excel.Application $ExcelWorkBook = $Excel.Workbooks.Open($excel_file_path) $ExcelWorkSheet = $Excel.WorkSheets.item("sheet1") $ExcelWorkSheet.activate() ## Find the first row where the first

Unhandled Exception in vc++ - HRESULT failed

空扰寡人 提交于 2019-12-07 09:53:23
问题 I know the VC++6.0 is very old language, but i don't have a choice, i am just maintaining an existing program, and i encounter this error Unhandled exception in Assess.exe (KERNELBASE.DLL): 0xE06D7363: Microsoft C++ Exception And here is my code HRESULT hr = CoInitialize(NULL); // Create the interface pointer. IModulePtr pI(__uuidof(RPTAModuleInterface)); //the error is here After debugging and using f11 the program goes to COMIP.H and here is the code explicit _com_ptr_t(const CLSID& clsid,

COM `HRESULT` is wrapped into an Exception in .NET

喜你入骨 提交于 2019-12-07 01:54:08
问题 (preliminary note: I'm not yet fully up to speed with the whole 'interop' thing...) When using a COM library from within .NET, all HRESULT methods are wrapped into something that throws when the return code is not SUCCEEDED. //ATL magic exluded class C { HRESULT foo(){ return E_FAIL; } }; // usage code: if( SUCCEEDED( c.foo() ) ) { // success code } else { // failure code } The .NET counterpart of this code reads: try { c.foo(); // success code } catch ( Exception e ) { // failure code } Is

Exception: Error HRESULT E_FAIL with Microsoft LightSwitch Visual Studio 2012 RC

守給你的承諾、 提交于 2019-12-06 11:18:46
问题 I installed Visual Studio 2012 RC recently along with VS 2012 SDK and LightSwitch Extensibility Toolkit. this is the XAML code in my Client.Design -> TControl.XAML file <UserControl x:Class="CustomControls.Presentation.Controls.TControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:framework="clr-namespace:Microsoft.LightSwitch.Presentation.Framework;assembly=Microsoft.LightSwitch.Client"> <Grid Width="Auto">

Unhandled Exception in vc++ - HRESULT failed

久未见 提交于 2019-12-05 13:16:31
I know the VC++6.0 is very old language, but i don't have a choice, i am just maintaining an existing program, and i encounter this error Unhandled exception in Assess.exe (KERNELBASE.DLL): 0xE06D7363: Microsoft C++ Exception And here is my code HRESULT hr = CoInitialize(NULL); // Create the interface pointer. IModulePtr pI(__uuidof(RPTAModuleInterface)); //the error is here After debugging and using f11 the program goes to COMIP.H and here is the code explicit _com_ptr_t(const CLSID& clsid, IUnknown* pOuter = NULL, DWORD dwClsContext = CLSCTX_ALL) throw(_com_error) : m_pInterface(NULL) {

In Windows, is there any way to convert an errno into an HRESULT?

浪子不回头ぞ 提交于 2019-12-05 07:14:29
I know the HRESULT_FROM_WIN32 macro to convert a Win32 error code into an HRESULT, is there any way to do the conversion starting from an errno error? In short, no. As of http://msdn.microsoft.com/en-us/library/5814770t%28v=vs.100%29.aspx The errno values are constants assigned to errno in the event of various error conditions. ERRNO.H contains the definitions of the errno values. However, not all the definitions given in ERRNO.H are used in 32-bit Windows operating systems. Some of the values in ERRNO.H are present to maintain compatibility with the UNIX family of operating systems. The errno

How to distinguish programmatically between different IOExceptions?

独自空忆成欢 提交于 2019-12-05 03:22:37
I am doing some exception handling for code which is writing to the StandardInput stream of a Process object. The Process is kind of like the unix head command; it reads only part of it's input stream. When the process dies, the writing thread fails with: IOException The pipe has been ended. (Exception from HRESULT: 0x8007006D) I would like to catch this exception and let it fail gracefully, since this is expected behavior. However, it's not obvious to me how this can robustly be distinguished from other IOExceptions. I could use message, but it's my understanding that these are localized and