com

Which blocking threading operations in .NET will handle COM messages when blocked?

99封情书 提交于 2019-12-07 15:34:32
问题 When creating a new STA thread to host an STA COM component, it is the responsibility of that thread to pump Windows messages related to COM. From what I've been able to gather, certain built in .NET threading primitives such as lock (Monitor.Enter) will do this for you while waiting for the object to be released by another thread. Another way of making .NET pump COM messages for you that I've seen is to use .Join(). Where can I find a complete list of built in threading primitives with this

PowerPoint 2007 SP2, ExportAsFixedFormat in PowerShell?

血红的双手。 提交于 2019-12-07 15:10:48
Yesterday I was trying to batch convert a group of PPTs into PDFs for a friend, and I decided to have a look at PowerShell, since it's been sitting on my HD for a while. Here's the code I've come up with. $p = new-object -comobject powerpoint.application # I actually don't know why I have to set the window to visible, # but it doesn't work otherwise, anyway, it's not the real problem I have $p.visible = 1 $f = $p.presentations.open('\some\file.ppt') $f.ExportAsFixedFormat('\some\newfile.pdf', 2) 2 is for PDF Since the "brute force" method didn't work ("type mismatch") I tried to import the

Why is my DLL failing to register?

匆匆过客 提交于 2019-12-07 14:41:27
问题 I am building a project in VS2005 and several of my DLLs are failing to register. The error message I am getting in Visual Studio is: Project : error PRJ0019: A tool returned an error code from "Registering ActiveX Control..." which is nicely vague. When I register the DLL manually through the command line (using regsv32.exe , I get the following error: LoadLibrary("test.ocx") failed - This application has failed to start because the application configuration is incorrect. Reinstalling the

Matlab : running a function in a COM server without blocking matlab?

三世轮回 提交于 2019-12-07 14:18:08
问题 I'm working on Matlab 64-bits R2011b, and I have to use a 32-bits version (I have R2010b installed) to command a hardware (32-bit dll). For that, I created a COM server with actxserver() and it works. However, whenever a function takes time in the 32-bit session, the 64-bit session becomes 'busy' and nothing works anymore until completion. I simplified my problem in the script below : if you have two Matlab versions installed, you can try my code and see my problem. In a few words : one

Is this .tlh file correct, and if not, then how do I generate the correct one?

蓝咒 提交于 2019-12-07 13:44:25
问题 I am trying to call a .NET 4.0 dll from unmanaged C++ code. I followed the instructions in this Code Project article by Atul Mani. I built the .NET dll, and followed all the steps up to and including registering it with regasm. Next, I created an unmanaged C++ project and added this line at the start of the .cpp file: #import "D:\PathToMyCSharpProject\bin\Debug\com.DeviceServices.tlb" rename ("EOF","adoEOF") no_namespace named_guids raw_interfaces_only When I built the C++ project, a .tlh

Running 32 bit app using 32 bit com on a 64 bit Windows machine

我的未来我决定 提交于 2019-12-07 13:38:34
问题 I have a C# application using C++ COM object both build on a 32 bit machine. Now I have to run them on a 64 bit machine. I registered the COM object. A corresponding entry was created in the register under computer\hkey_classes_root\wow6432node\clsid{xxx}. However, when I try to run the application it says that |"Retrieving the COM class factory for component with CLSID {xxx} failed due to the following error: 80040154.". As I understand, the error code means that the class is not registered.

SideBySide Registration-Free COM fail while loading

陌路散爱 提交于 2019-12-07 13:25:37
问题 i'm trying to create a C# COM Server which is used by a Delphi App without a COM-Registration. The process is descried on a ms blog - Registration-Free Activation of .NET-Based Components: A Walkthrough I created the necessarily manifest files and i linked them to the assemblies. The App Manifest: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assemblyIdentity type="win32" name="Vorg" version="1.0.0.0" />

Why do IUnknown* pointers retrieved through different interfaces of the same COM object have the same value?

与世无争的帅哥 提交于 2019-12-07 13:17:21
问题 I have the following hierarchy of COM interfaces and a class implementing them: interface IX : public IUnknown{}; interface IY : public IUnknown{}; class CA: public IX, public IY{}; Here class CA effectively inherits from IUnknown twice. We know there are two vtable pointers in class CA - one is pointed to IX and another is pointed to IY . So IUnknown stored in the IX subobject is different from IUnknown stored in the IY subobject. Yet when we call IX::QueryInterface() or IY::QueryInterface()

Inspecting an instance of a COM / Interop class properly in VS.Net's debugger?

故事扮演 提交于 2019-12-07 13:15:57
问题 Does anyone know if and how it's possible to see COM / Interop objects properly (in their correct type) in VisualStudio's debugger? All I get is the ' evil ' System.__ComObject value (even though it correctly identifies the type)? E.g.: 回答1: So, this isn't an answer, but check out these two screen shots. This is from the same application, just at two different break points. In both cases the COM objects are from the same COM/AX library. I've no idea why in one case I see "System.__ComObject"

How to clean up COM references in .NET when app will be left running?

旧时模样 提交于 2019-12-07 12:49:50
问题 I am working on a .NET program that starts a new instance of Excel, does some work, then ends, but must leave Excel running. Later, when the program runs again, it will attempt to hook into the previous instance. What is the best way to handle the releasing of COM objects in this situation? If I do not do a "ReleaseComObject" on the app object the first time, then on the second run get the active object, then finally release the com object, do I have a memory leak? The following simplified