com

Error 80040154 (Class not registered exception) when initializing VCProjectEngineObject (Microsoft.VisualStudio.VCProjectEngine.dll)

随声附和 提交于 2019-12-17 05:03:49
问题 I'm trying to run this tool in order to convert a Visual C++ project to makefile. The project I'm trying to convert project is written in VS2008, so I'm using a reference to Microsoft.VisualStudio.VCProjectEngine.dll from version 9. It fails in this line: VCProjectEngine vcprojEngine = new VCProjectEngineObject(); With the following exception: Retrieving the COM class factory for component with CLSID {D19A00C4-A7F9-4E14-A5E1-D060B7EB57F3} failed due to the following error: 80040154 Class not

Best way to access COM objects from C#

a 夏天 提交于 2019-12-17 03:08:49
问题 I am planning to use various objects that are exposed as COM objects. To make them easier to use, I'd like to wrap them as C# objects. What is the best approach for this? 回答1: If the library is already registered, you can perform the following steps to have Visual Studio generate an interop assembly for you: Open to your Visual Studio project. Right click on 'References' (right under the project in your Solution Explorer) and select 'Add Reference'. Select the COM tab. (If you don't see this,

Getting ScriptControl to work with Excel 2010 x64

时光毁灭记忆、已成空白 提交于 2019-12-17 02:24:13
问题 I am trying to use the solution given to this, however, whenever I try to run the most basic anything, I get an Object not Defined error. I thought this would be my fault (not having installed ScriptControl). However, I tried installing as described in here, to no avail. I am running Windows 7 Professional x64 with Office 2010 64 bit. 回答1: Sadly, scriptcontrol is a 32bit component only and will not run inside a 64bit process. 回答2: You can create ActiveX objects like ScriptControl , which

Generate manifest files for registration-free COM

一世执手 提交于 2019-12-16 20:44:46
问题 I have some applications (some native, some .NET) which use manifest files so that they can be deployed in complete isolation, without requiring any global COM registration. For example, the dependency on the dbgrid32.ocx com server is declared as follows in the myapp.exe.manifest file which sits in the same folder as myapp.exe: <?xml version="1.0" encoding="utf-8" standalone="yes"?> <assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyIdentity type="win32" name=

Generate manifest files for registration-free COM

三世轮回 提交于 2019-12-16 20:44:27
问题 I have some applications (some native, some .NET) which use manifest files so that they can be deployed in complete isolation, without requiring any global COM registration. For example, the dependency on the dbgrid32.ocx com server is declared as follows in the myapp.exe.manifest file which sits in the same folder as myapp.exe: <?xml version="1.0" encoding="utf-8" standalone="yes"?> <assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyIdentity type="win32" name=

How to handle AccessViolationException

有些话、适合烂在心里 提交于 2019-12-16 19:53:14
问题 I am using a COM object (MODI) from within my .net application. The method I am calling throws a System.AccessViolationException, which is intercepted by Visual Studio. The odd thing is that I have wrapped my call in a try catch, which has handlers for AccessViolationException, COMException and everything else, but when Visual Studio (2010) intercepts the AccessViolationException, the debugger breaks on the method call (doc.OCR), and if I step through, it continues to the next line instead of

Making an async COM call — do I have to create my own P/S?

╄→尐↘猪︶ㄣ 提交于 2019-12-16 18:04:52
问题 I have a custom interface defined in a type library and implemented in my code. I have not created my own proxy/stub. I have successfully marshaled the interface pointer from my main thread (STA) to a background thread (STA), in my case using IGlobalInterfaceTable. From that background thread, I want to make an asynchronous call to the object on the UI thread. I have not implemented ICallFactory in my object. I see that the standard proxy does indeed implement ICallFactory (i.e, I can

IPreviewHandler throws uncatchable exception

╄→尐↘猪︶ㄣ 提交于 2019-12-14 04:25:11
问题 I've imported the COM interface IPreviewHandler into a WinForms app and am using it to display previews for various types of documents (I look up the GUID of the appropriate preview handler in the registry, then use Activator.CreateInstance(guid) to instantiate the specific COM class. This works wonderfully for the vast majority of file types - Office formats, PDFs, videos, etc - however, after I instantiate the "Microsoft Windows TXT Preview Handler" {1531d583-8375-4d3f-b5fb-d23bbd169f22} ,

How do I determine the internal HWND used by COM in my current process?

故事扮演 提交于 2019-12-14 04:14:36
问题 I want to Post messages directly to the HWND that's owned by COM in my process. How do I get the HWND that COM is using in single-threaded-apartment mode? 回答1: Try this: HWND prevWindow = NULL; HWND hwnd; for ( ;; ) { hwnd = FindWindowEx( HWND_MESSAGE, prevWindow, L"OleMainThreadWndClass", NULL ); if ( !hwnd ) break; if ( GetWindowThreadProcessId( hwnd, NULL ) == GetCurrentThreadId() ) break; prevWindow = hwnd; WCHAR className[255]; *className = 0; ::GetClassName( hwnd, className, 255 ); }

Intemittent Cannot create ActiveX component

∥☆過路亽.° 提交于 2019-12-14 04:12:21
问题 Everything was working fine, and then our code starts throwing: Cannot create ActiveX component when we try to create a com object. We reboot the server a couple of times and it goes away Then after a while it comes back This is driving us nuts. Any help appreciated. 回答1: I apologize that the question was vague. However we had no clue what was causing the problem so what facts would have been relevant? At any rate it turns out we have two web apps running under IIS, both are trying to create