com

HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))

孤街浪徒 提交于 2019-12-17 16:31:58
问题 I am building a GIS Application but whenever I run the code it's giving me this error System.Runtime.InteropServices.COMException was unhandled Retrieving the COM class factory for component with CLSID {FBF5715D-A05D-11D4-A64C-0008C711C8C1} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)). Also, in the Project Properties the Option for Register For COM Interop is disabled. 回答1: This could also be an issue of building

How can I detect the type of a dll? (COM, .NET, WIN32)

大兔子大兔子 提交于 2019-12-17 16:07:04
问题 I need to process a number of dll's and exe files in a folder and determine what type of file I am dealing with: .NET, COM, Win32 or some other alien life form. I've been trying to determine the easiest way to detect the type of a DLL, what do you think of this: COM dll => I do a LoadLibrary, then GetProcAddress for " DllRegisterServer ". If I get a valid return, it's a COM file. .NET dll => If the dll depends on MSCOREE.DLL it's always a .NET dll? Win32 dll => If both the above tests fail,

Proper way of releasing COM objects?

元气小坏坏 提交于 2019-12-17 15:51:33
问题 Sometimes when I end the application and it tries to release some COM objects, I receive a warning in the debugger: RaceOnRCWCleanUp was detected If I write a class which uses COM objects, do I need to implement IDisposable and call Marshal.FinalReleaseComObject on them in IDisposable.Dispose to properly release them? If Dispose is not called manually then, do I still need to release them in the finalizer or will the GC release them automatically? Now I call Dispose(false) in the finalizer

RCW & reference counting when using COM interop in C#

↘锁芯ラ 提交于 2019-12-17 15:26:02
问题 I have an application that uses Office interop assemblies. I am aware about the "Runtime Callable Wrapper (RCW)" managed by the runtime. But I am not very sure how the reference count gets incremented. MSDN says, RCW keeps just one reference to the wrapped COM object regardless of the number of managed clients calling it. If I understand it correctly, on the following example, using Microsoft.Office.Interop.Word; static void Foo(Application wrd) { /* .... */ } static void Main(string[] args)

BSTR to std::string (std::wstring) and vice versa

我的未来我决定 提交于 2019-12-17 10:16:36
问题 While working with COM in C++ the strings are usually of BSTR data type. Someone can use BSTR wrapper like CComBSTR or MS's CString . But because I can't use ATL or MFC in MinGW compiler, is there standard code snippet to convert BSTR to std::string (or std::wstring ) and vice versa? Are there also some non-MS wrappers for BSTR similar to CComBSTR ? Update Thanks to everyone who helped me out in any way! Just because no one has addressed the issue on conversion between BSTR and std::string ,

What are the differences between using the New keyword and calling CreateObject in Excel VBA?

╄→гoц情女王★ 提交于 2019-12-17 09:53:48
问题 What criteria should I use to decide whether I write VBA code like this: Set xmlDocument = New MSXML2.DOMDocument or like this: Set xmlDocument = CreateObject("MSXML2.DOMDocument") ? 回答1: As long as the variable is not typed as object Dim xmlDocument as MSXML2.DOMDocument Set xmlDocument = CreateObject("MSXML2.DOMDocument") is the same as Dim xmlDocument as MSXML2.DOMDocument Set xmlDocument = New MSXML2.DOMDocument both use early binding. Whereas Dim xmlDocument as Object Set xmlDocument =

How to make make a .NET COM object apartment-threaded?

本小妞迷上赌 提交于 2019-12-17 09:48:05
问题 .NET objects are free-threaded by default. If marshaled to another thread via COM, they always get marshaled to themselves, regardless of whether the creator thread was STA or not, and regardless of their ThreadingModel registry value. I suspect, they aggregate the Free Threaded Marshaler (more details about COM threading could be found here). I want to make my .NET COM object use the standard COM marshaller proxy when marshaled to another thread. The problem: using System; using System

C# exposing to COM - interface inheritance

冷暖自知 提交于 2019-12-17 09:47:23
问题 Say I have a class BaseClass that implements IBaseClass Then I have an interface IClass that inherits IBaseClass. Then I have a class named class that implements IClass. For example: [ComVisible(true), InterfaceType(ComInterfaceType.IsDual), Guid("XXXXXXX")] public interface IBaseClass { [PreserveSig] string GetA() } [ComVisible(true), InterfaceType(ComInterfaceType.IsDual), Guid("XXXXXXX")] public interface IClass : IBaseClass { [PreserveSig] string GetB() } [ComVisible(true), ClassInterface

C# exposing to COM - interface inheritance

微笑、不失礼 提交于 2019-12-17 09:47:08
问题 Say I have a class BaseClass that implements IBaseClass Then I have an interface IClass that inherits IBaseClass. Then I have a class named class that implements IClass. For example: [ComVisible(true), InterfaceType(ComInterfaceType.IsDual), Guid("XXXXXXX")] public interface IBaseClass { [PreserveSig] string GetA() } [ComVisible(true), InterfaceType(ComInterfaceType.IsDual), Guid("XXXXXXX")] public interface IClass : IBaseClass { [PreserveSig] string GetB() } [ComVisible(true), ClassInterface

Can Ruby import a .NET dll?

て烟熏妆下的殇ゞ 提交于 2019-12-17 08:50:51
问题 I am interested in using/learning RoR in a project where I have to use a .NET dll. Is Ruby capable of importing a .NET dll? 回答1: While IronRuby will make short work of talking to your .NET dll (it'll be literally no code at all), it was abandoned by microsoft, and it never got a large enough open source community to keep it going after that event. I wouldn't recommend it these days Regarding the COM solution, this may actually be a good way to go. You don't need the RubyCOM library - that