com

Firing a COM Event From Another Thread

主宰稳场 提交于 2020-01-01 07:06:27
问题 I have created an in-process COM object (DLL) using ATL. Note that this is an object and not a control (so has no window or user-interface.) My problem is that I am trying to fire an event from a second thread and I am getting a 'Catastrophic failure' (0x8000FFFF). If I fire the event from my main thread, then I don't get the error. The second thread is calling CoInitializeEx but this makes no difference. I am using the Apartment threading model but switching to Free Threaded doesn't help.

Getting a specific instance of COM object in VB.Net

梦想的初衷 提交于 2020-01-01 06:38:16
问题 I am writing a Windows Form application in .Net to list all running instances of a third-party CAD/CAM software (in this case CATIA) and let user to choose one of them to perform couple of automated tasks. For performing automated tasks, I need to get the specific instance of COM objects - compared to Getobject() which gives me a non-specific COM instance. Is there a way to get a specific COM instance using window handle or any other methods? UPDATE: As Raymond said there is no single

Use C# for Catia V5 Automation

我与影子孤独终老i 提交于 2020-01-01 03:44:08
问题 I want to write Macros/Programs for Catia V5 with the programming language C#. How is it possible to access the Catia applicataion via c#(and Visual Studio). I searched a bit and found out that Catia provides an API, which the Microsoft COM Technologie provides for 'COM-languages' like c# & python. This is how I imagine the connection/interaction between a C# Programm and Catia: C# - .NET <-bi-directional integration-> COM <-> Catia API Is that correct ? Also: How do I setup everything in

Silverlight and COM Interop

无人久伴 提交于 2020-01-01 03:40:28
问题 What are my options for interacting with a COM control from silverlight? In my particular project, I have a legacy ActiveX authentication control which I would like to leverage in my silverlight application. Without too many boring details, the control takes a couple of parameters, prompts the user for credentials or tokens, and raises events. I need to set the parameters from my control, and somehow get the events' data to my control. Furthermore, I would like to get the UI to seem as

download a file using windows IStream

穿精又带淫゛_ 提交于 2020-01-01 03:38:06
问题 I'm implementing dragging a virtual file out of a website and onto the desktop with an activex control. How do I create an IStream on my http url, so Windows can execute the drop? The example I'm looking at uses SHCreateStreamOnFile to copy a local file; there must be an analogous function for other types of streams like http file download. 回答1: How about using the URL Moniker Functions. You can use the URLDownloadToFile (blocking function), or URLOpenPullStream (asynchronous). 来源: https:/

How to declare and implement a COM interface on C# that inherits from another COM interface?

为君一笑 提交于 2020-01-01 03:27:04
问题 I'm trying to understand what is the correct why to implement COM interfaces from C# code. It is straightforward when the interface doesn't inherit from other base interface. Like this one: [ComImport, Guid("2047E320-F2A9-11CE-AE65-08002B2E1262"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IShellFolderViewCB { long MessageSFVCB(uint uMsg, int wParam, int lParam); } However things start to become weired when I need to implement an interface that inherits from other

How can I use Microsoft Word's spelling/grammar checker programmatically?

删除回忆录丶 提交于 2020-01-01 03:21:05
问题 I want to process a medium to large number of text snippets using a spelling/grammar checker to get a rough approximation and ranking of their "quality." Speed is not really of concern either, so I think the easiest way is to write a script that passes off the snippets to Microsoft Word (2007) and runs its spelling and grammar checker on them. Is there a way to do this from a script (specifically, Python)? What is a good resource for learning about controlling Word programmatically? If not, I

Difference between pointer-to-pointer vs reference-to-pointer (C++)

大憨熊 提交于 2020-01-01 03:17:07
问题 I have a bit of COM code that uses interface pointers. The original author of the code implemented functions that return an interface pointer like this: HRESULT Query ( IN BSTR sQuery, OUT IEnumWbemClassObject* &pEnumerator ); // (1) instead of the traditional HRESULT Query ( IN BSTR sQuery, OUT IEnumWbemClassObject** ppEnumerator ); // (2) The function (1) is called like this: hRes = Query ( sQuery, pEnumerator ); // (3) which definitely looks wrong but it works fine. I'm not sure if I'm

How does Visual Studio's debugger/interactive window dump the properties of COM Objects in .NET?

空扰寡人 提交于 2020-01-01 02:46:25
问题 In this related question, I noted that Visual Studio's debugger is able to enumerate the properties of System.__ComObject references, which is "a hidden type used when the wrapper type is ambiguous" -- e.g., the type of object you get when you obtain it from another COM object and don't instantiate it yourself: Additionally, if you simply write a COM object's identifier into the Immediate Window, its properties and values are similarly dumped: Note that this is separate from VS2010's "Dynamic

Retrieving the COM class factory for component with CLSID Error: 8000401a

半腔热情 提交于 2020-01-01 01:17:35
问题 from last so many times I am getting the below error.As I am using the Microsoft Word dlls to create word files which further attached to the mail. Server Error in '/' Application. Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 8000401a. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it