com

COM method call returns Catastrophic Failure

浪子不回头ぞ 提交于 2019-12-24 12:34:30
问题 Note: Pass BSTR variable to COM method, HRESULT return is 8000FFFF Previous calls with interface pointer , was successful : HRESULT is 0 Execution, inside Visual Studio succeeds , outside fails - release and debug Illustration: const char *simFile; simFile = new char; //omitted _bstr_t simFileToOpen(simFile); BSTR raw_sim_Open = simFileToOpen.copy(); SysFreeString(simFileToOpen); delete simFile; hresult = pis8->raw_Open (raw_sim_Open); //0x8000FFFF returned 回答1: simFile looks to be a single

Using AccessibleObjectFromWindow in python on Microsoft Word instance

我只是一个虾纸丫 提交于 2019-12-24 12:04:11
问题 I am trying to manipulate a particular already-open, unsaved (so no path) Word document (*.doc) with python. The manipulations work great if only one Word instance is open, however multiple instances create some difficulty, reference the SO question Word VBA and Multiple Word Instances. I have found some references on dealing with this in C# (How to access Microsoft Word existing instance using late binding) and VB.NET (Multiple Instances of Applications) and have managed to translate them to

Force cast a COM object to an interface

蓝咒 提交于 2019-12-24 11:59:17
问题 I'm using a COM API to access a certain class, but the app developer has not fully exposed the class to COM. So when I type shape.Custom.Cells VS complains "Cells does not exist .. bla bla bla..". But, when I debug my code, and open up the object inside the VS debugger, it HAS properties! .. exactly the properties I'm trying to access! So I'm trying to access these properties with a handwritten interface: internal interface CorelTableShape { object Cells { get; } object Borders { get; }

Could QueryInterface() provide us with nullptr when succeed? [duplicate]

你离开我真会死。 提交于 2019-12-24 11:26:58
问题 This question already has answers here : Handling CoCreateInstance return value (2 answers) Closed 5 years ago . Imagine a situation: CComPtr<IGraphBuilder> pGraph; HRESULT hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pGraph)); if (SUCCEEDED(hr)) { CComPtr<IMediaControl> pControl; hr = pGraph->QueryInterface(IID_PPV_ARGS(&pControl)); if(SUCCEEDED(hr)) {...} } I wonder, if pControl could ever be nullptr inside last block {...} . The question occurred,

Why genguid.exe generated clsid won't work?

*爱你&永不变心* 提交于 2019-12-24 11:18:17
问题 I am trying to modify exceladdin.py example from pywin demos. Otherwise I can modify it, but when I replace the clsid given in example: "{C5482ECA-F559-45A0-B078-B2036E6F011A}" With the one generated by genguid.exe or pythoncom.CreateGuid() e.g.: "{E44EF798-7FDF-4015-AED6-00234CBBBA77}" The com-addin stops working. No trace, no errors just the following text in excel com-objects list (translation) "Add-in not loaded. Error in runtime while loading com object." Am I missing a step in

Is .NET Core compatible with COM?

只谈情不闲聊 提交于 2019-12-24 11:14:11
问题 I am trying to understand the implications of starting a project on .NET core. One of the requirement I am facing is to use a .NET library that is leveraging COM. So is COM supported by .NET core (obviously, assuming the OS is Windows)? I understand that .NET Core is built for interoperability between different OS. But I was wondering if it is to be expected that there are Windows-specific features that may be included for the windows releases such as COM compatibility. Thanks for your help.

Using a .net4 based dll from .net2 based app not working for website

天涯浪子 提交于 2019-12-24 11:08:10
问题 Given this reference: https://code.msdn.microsoft.com/windowsdesktop/Using-a-NET-4-Based-DLL-bb141db3 Is it possible to add a .net2/3.5 website (not a web project) project to this solution and make it work with the adapter? I've tried but no luck. I keep getting error: Could not load file or assembly 'Net4Assembly' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. 来源: https://stackoverflow.com/questions/40666392/using

COMException “Library not registered.” while using System.DirectoryServices

♀尐吖头ヾ 提交于 2019-12-24 10:59:38
问题 I have only just started received the following error in my windows forms application under .NET 2 framework on windows 2000 when using System.DirectoryServices . {System.Runtime.InteropServices.COMException} System.Runtime.InteropServices.COMException: {"Library not registered."} _className: Nothing _COMPlusExceptionCode: -532459699 _data: Nothing _dynamicMethods: Nothing _exceptionMethod: Nothing _exceptionMethodString: Nothing _helpURL: Nothing _HResult: -2147319779 _innerException:

Get the address of an object that has overloaded operator&

雨燕双飞 提交于 2019-12-24 10:58:47
问题 operator& for CComPtr is overloaded, which makes my generically written code crash. I am wondering if there is any way to force a variable into returning the address of it's object? 回答1: The solution is hideous: reinterpret_cast<CComPtr*>(&reinterpret_cast<char&>(ptr)) 回答2: If you can use boost, consider using: addressof, if you cannot, take a look at the implementation. 回答3: You could cast the CComPtr to a CComPtrBase , which, from what I can gather from the MSDN page, has no overloaded

CLSIDFromProgID is successful but CreateInstace fails! Why?

帅比萌擦擦* 提交于 2019-12-24 10:56:36
问题 I am trying to create an instance of a COM object. I have the class name that implements the interface and I get a CLSID by using CLSIDFromProgID(). So since I am getting a CLSID I thought everything should be fine from now on. However when I do a call to CreateInstance and pass in the CLSID, I get an error saying "Class not registered". Also I get this error only in some computers. It runs error free on several computers. I don't understand where the problem could be. Is my registry dirty?