com

Java COM bridge

谁说胖子不能爱 提交于 2019-12-23 17:36:06
问题 I have an ultra-low latency program and need to interface with a Windows COM component. What would be the fastest way to do this? Using a COM bridge like JACOB or write a native COM library and send out messages using a messaging bus like ZeroMQ? 回答1: If you use ZeroMQ, you'll be dealing with two processes. And passing a message from one process to another is more expensive than doing the same within the same process. So using a Java COM bridge will certainly result in a lower latency. Having

“The type library importer could not convert the signature for the member” warning in a trivial setup

此生再无相见时 提交于 2019-12-23 17:27:48
问题 Observe this most trivial IDL file: import "unknwn.idl"; typedef struct _MyStruct { DWORD len; [size_is(len)] BYTE *buffer; } MyStruct; [ object, uuid(903C11E8-46A0-4E6E-B54C-6619B6A42CCB), pointer_default(unique) ] interface IMyIntf : IUnknown { [local] HRESULT Func([in] MyStruct *pObj); }; [ uuid(BAC6289C-503C-4ADD-B27A-4F22D726C109), version(1.0), ] library Lib { importlib("stdole2.tlb"); [ uuid(76D40083-C27F-45FB-88DC-C3E7DF9B5988) ] coclass MyClass { [default] interface IMyIntf; }; };

How to access COM objects from different apartment models?

三世轮回 提交于 2019-12-23 17:04:10
问题 I have a multi-threaded C++Builder GUI app, which communicates with a third-party app via COM. I need to call methods of the COM object from several threads, and I'm protecting access with a mutex. Apparently, the main GUI thread must use STA model, but my worker threads need to use MTA. The COM object is constructed in an MTA thread. Everything works fine except access to the COM object from the GUI thread, due to the MTA/STA mismatch. I've read a bit about marshalling, but haven't tried to

FaxServer Alternative for Windows Server 2008

為{幸葍}努か 提交于 2019-12-23 16:45:01
问题 To send a fax internally, we have been using the following Coldfusion code to create the object that handles the fax: <cfobject type="COM" action="Create" name="objFaxServer" class="FaxServer.FaxServer.1"> While we are remaining on ColdFusion 8, we are moving our server to Windows Server 2008, which is a 64-bit system. As a result, we are now unable to call COM objects, such as FaxServer, to handle such requests. I'm looking for an internal alternative (no 3rd party like InterFax.net) but I

COM Interop & Outlook - Make Outlook Visible?

99封情书 提交于 2019-12-23 16:43:26
问题 I'm automating Outlook from a VB.NET program, transferring items into the calendar and contacts at the user's request. It's all working, that isn't the problem; the problem is that automating Outlook like this when it wasn't already open creates a hidden instance. I can perhaps understand how this could be useful, to stop the user closing it down while you're still working on it, but since Outlook appears to force one instance only, if the user tries to inspect the changes made while my

How does WPF store the language dictionaries?

偶尔善良 提交于 2019-12-23 16:28:14
问题 According to https://msdn.microsoft.com/en-us/library/system.windows.controls.spellcheck(v=vs.110).aspx There are 4 languages supported. How does it store the dictionaries? Is it a (signed) resource file? An access database? Mostly, I need to get access to the list of the words in the dictionary, so programmatic access to that word list would be great, but I'm also curious about the implementation. I have traced it down to the SpellerInterop, but then if I understand my COM (And I'm not

Prevent user from attaching to run-by-developer instance of MS-Office process

余生长醉 提交于 2019-12-23 16:19:06
问题 I encounter the following issue: After I start any Ms-Office application via COM in my C++ code (Word, Excel, PowerPoint, Visio) and make it hidden - then if user starts its own intance of that application - it will attach to run-by-my-code office process, while I have no idea of that. Eventually after my code has executed I close Office Application and a user will lose its work (As far as they attached to my process and didn't start its own one) So, 1) is there any way to prevent a user from

WMI Exception: “COM object that has been separated from its underlying RCW cannot be used”

允我心安 提交于 2019-12-23 16:08:31
问题 I'm subscribing to a WMI event and receiving a " COM object that has been separated from its underlying RCW cannot be used " error when my application closes. This question has been asked before, but it is quite different from my circumstances. I am calling this code from my main thread: string strComputer = @"."; ManagementScope scope = new ManagementScope(@"\\" + strComputer + @"\root\wmi"); scope.Connect(); EventQuery query = new EventQuery("Select * from MSNdis_StatusMediaDisconnect");

String for C# from C++ COM

人盡茶涼 提交于 2019-12-23 16:01:52
问题 I have a C++ DLL and some functions return Unicode null-terminated strings: void SomeFunc(wchar_t* StrBuf) The caller must allocate StrBuf - string can be up to 256 characters. This DLL also exposes a COM object to use this DLL from C# via COM. Definition in IDL: [id(1), helpstring("bla")] HRESULT SomeFunc([in,out] BSTR* TextStr, [out,retval] LONG* RetValue); Currently the C# code looks like this: string val = new string('\0', 256); // Allocate memory MyComObj.SomeFunc(ref val); // Get string

What interface to I need to implement to allow ForEach in VBA on a COM object written in delphi?

馋奶兔 提交于 2019-12-23 15:48:15
问题 Imagine I want to do something like this in VBA (pseudocode), and assuming my has an enumerable property IDList: Dim MyObject object set MyObject= CreateObject("MyObjectClass") for each Item as integer in MyObject.IDList Debug.Write(Cstr(Item) & ";") Next What would my property IDList have to look like in Delphi? Simply deriving it from IEnumerable<integer> or IEnumerable does not seem to do the job. Base code In order to avoid trouble with the default IENum and IEnum<T> interfaces I have