com

What determines how long does an out of process COM server takes to notice that a client has died?

本秂侑毒 提交于 2019-12-21 17:21:56
问题 In a simple windows setup we have a COM singleton that runs as an out of process server. Clients connect by calling cocreate and each receives an interface to the same instance of the server. If clients shutdown normally they release their references. The server has a bit of logic that keeps it alive for a short time after the last release to allow for new connections. I'm interested in one special case - the server is running with only one client which crashes (consider this to be any random

Any method for accessing Windows COM methods using Java?

让人想犯罪 __ 提交于 2019-12-21 16:59:26
问题 I have an application which makes use of JNA to call functions from a hardware abstraction library in C++. One of the supported hardware devices requires Windows COM subsystem to be initialized (via CoInitialize or CoInitializeEx). Does anybody know any Java library which can do the trick? I know I could wrap some Windows functions, but if I had something ready and tested, that would be better. I found one called JACOB but it is said that the documentation is not good and it's been a long

Python win32 com : how to handle 'out' parameter?

徘徊边缘 提交于 2019-12-21 16:34:47
问题 I need to access a third-party COM server with following interface definition (idl): interface IDisplay : IDispatch { HRESULT getFramebuffer ( [in] ULONG aScreenId, [out] IFramebuffer * * aFramebuffer, [out] LONG * aXOrigin, [out] LONG * aYOrigin ); }; As you can see, it returns 3 values via [out] parameter modificators. How to handle this via python win32 COM api? For example, i create an object and get IDisplay from it: object = win32com.client.Dispatch( "VirtualBox.VirtualBox" ) display =

Why does this implementation of COM IUnknown::Release work?

╄→尐↘猪︶ㄣ 提交于 2019-12-21 14:48:13
问题 From examples I've seen COM IUnknown::Release() function implementation is something like that: ULONG Release() { InterlockedDecrement(&m_count); if(m_count == 0) { delete this; } return m_count; } So, if m_count is 0, so we're deleting "this" object, and returning the ref count. What I don't understand is why it works ?!?! Deleting the object wouldn't ruin the call stack or is it okay because it is being held by the thread, so it has nothing to do with the object ??? If the object has been

Why does this implementation of COM IUnknown::Release work?

 ̄綄美尐妖づ 提交于 2019-12-21 14:47:21
问题 From examples I've seen COM IUnknown::Release() function implementation is something like that: ULONG Release() { InterlockedDecrement(&m_count); if(m_count == 0) { delete this; } return m_count; } So, if m_count is 0, so we're deleting "this" object, and returning the ref count. What I don't understand is why it works ?!?! Deleting the object wouldn't ruin the call stack or is it okay because it is being held by the thread, so it has nothing to do with the object ??? If the object has been

Understand COM c# interfaces

随声附和 提交于 2019-12-21 13:36:42
问题 The Microsoft.Office.Interop.Word._Document interface has a method with the following signature: void Close(ref object SaveChanges = Type.Missing, ref object OriginalFormat = Type.Missing, ref object RouteDocument = Type.Missing); A few points I am having trouble understanding: A ref parameter cannot have a default value. A default value has to be a constant, and Type.Missing is not. When calling this method, I can use Close(false) - normally a ref parameter requires an assignable variable?

Visual Studio 2010 automation and environment variables

狂风中的少年 提交于 2019-12-21 13:11:07
问题 I am opening VS2010 solutions using C# and VS2010 automation. I open the solutions like this: Type type = Type.GetTypeFromProgID("VisualStudio.DTE.10.0", true); Object comObject = Activator.CreateInstance(type); ... sol.Open(solution_full_path); The problem I am having is that when I create the instance of the VisualStudio.DTE.10.0 object, it starts the devenv.exe process from winlogon.exe which sees completely different environment than my application. Some of the environment variables are

Control 2 separate Excel instances by COM independently… can it be done?

不问归期 提交于 2019-12-21 12:21:41
问题 I've got a legacy application which is implemented in a number of Excel workbooks. It's not something that I have the authority to re-implement, however another application that I do maintain does need to be able to call functions in the Excel workbook. It's been given a python interface using the Win32Com library. Other processes can call functions in my python package which in turn invokes the functions I need via Win32Com. Unfortunately COM does not allow me to specify a particular COM

Destroying COM object in Delphi

旧街凉风 提交于 2019-12-21 10:47:48
问题 Have some .net assembly, calling it in delphi through COM. var intf: ITest; ... intf:= CreateComObject(CLASS_TEST) as ITest; ... //here comes some stuff ... Must i do something to destruct it to free memory. Or not? 回答1: You should better release the memory with intf := nil; When you don't need it any more. Better with a try...finally intf := nil; block, or in the Destroy overriden method if intf is defined as fIntf , i.e. as a class property. If intf is defined on stack, it will we freed

Delphi 2009 COM/ActiveX Type Library support stability

烂漫一生 提交于 2019-12-21 09:16:09
问题 Referring to TLB and maintenance issues ... My question to people (often) using the new COM/ActiveX type library support in Delphi 2009 : How stable is the implementation? Especially, I'm interested in: adding/deleting classes, changing GUIDs, renaming methods/properties, reordering methods/properties, huge type libraries (50+ classes), ... Is it as stable as in Delphi 2007 (a nightmare) or Delphi 7 (quite OK, but sometimes you have to restore the TLB file from SVN) or super-stable (as in, ..