com

Is there a way to watch all COM activity on a computer?

时光怂恿深爱的人放手 提交于 2019-12-07 08:02:46
问题 I'm trying to deal with a piece of specialized hardware, that presents it's interface as a COM object, using win32com in Python. However, the documentation for how to actually set up the hardware through the COM object is sparse (it requires a significant amount of initialization), and entirely oriented at using a bunch of pre-built libraries for Visual Studio, which are not accessible through python. That said, is there any way to watch all local COM activity, so I can sort through the

C++ Microsoft: How to associate uuid/guid with template specialization

佐手、 提交于 2019-12-07 08:02:37
问题 I'd like to associate a uuid/guid with a template specialization. The following code can be used to associate a uuid with a non-template interface (class, struct): __interface __declspec(uuid("CECA446F-2BE6-4AAC-A117-E395F27DF1F8")) ITest { virtual void Test() = 0; }; GUID guid = __uuidof(ITest); // OK Now I have a templated interface template<class T> __interface ITemplateTest { virtual void Test(T t) = 0; }; and I'd like to make the following work: GUID templateGuid = __uuidof(ITemplateTest

Does order matter when registering, gac-ing assemblies for COM interop?

≡放荡痞女 提交于 2019-12-07 06:45:13
问题 When registering .NET assemblies for COM Interop, I do two things, currently in this order: regasm /tlb:MyDll.tlb Mydll.dll gacutil /i Mydll.dll I use regasm to register the type library for COM and gacutil to install the assembly into the GAC. Does it matter which order I do these two actions? Also, as I make updates to my dll, do I need to un-register and re-register it, uninstall it from the gac and re-install it, both or neither? 回答1: Does order matter? No. Do you need to reinstall in GAC

Diagnosing an app that fails to halt

梦想的初衷 提交于 2019-12-07 06:41:43
问题 Our Windows app is often hanging in memory and I'm trying to use windbg to track down the problem. I'm very new to windbg and could use some advice (I have started to read Advanced Windows Debugging though). The app is a mix of C++ and COM objects written in VB. Occasionally when you exit, the app appears to go away but task manager shows it hanging around in memory, apparently idle. !threads shows me this: ThreadCount: 2 UnstartedThread: 0 BackgroundThread: 2 PendingThread: 0 DeadThread: 0

Handle C# COM events in C++

╄→尐↘猪︶ㄣ 提交于 2019-12-07 06:27:16
问题 I have managed to create a C# COM object with events. Please find code below, [Guid("1212674-38748-45434")] public interface ICalculator { int Add(int Num1, int Num2); } [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] [Guid("3453674234-84444-84784")] public interface ICalculatorEvents { [DispId(1)] void Completed(int Result); } [ClassInterface(ClassInterfaceType.None)] [ComSourceInterfaces(typeof(ICalculatorEvents))] [Guid("87457845-945u48-4954")] public class Calculator : ICalculator

How do you efficiently copy BSTR to wchar_t[]?

廉价感情. 提交于 2019-12-07 06:25:56
问题 I have a BSTR object that I would like to convert to copy to a wchar__t object. The tricky thing is the length of the BSTR object could be anywhere from a few kilobytes to a few hundred kilobytes. Is there an efficient way of copying the data across? I know I could just declare a wchar_t array and alway allocate the maximum possible data it would ever need to hold. However, this would mean allocating hundreds of kilobytes of data for something that potentially might only require a few

COM Interop, RPC server is unavailable in c#

*爱你&永不变心* 提交于 2019-12-07 06:24:25
问题 I am using a COM Interop and i am instantiating the COM class object from the interop dll So, few times the object is instantiated successfully and make remote procedure calls without any problem but sometimes it throws an exception like RPC Server is unavilable. The COM Component i am using is written in VB and i am consuming that component in c#. So, can anybody tell me the possible reasons for the problem(RPC Server is Unavailable) and solutions to this problem. I am helpless with this

How do I use _com_ptr_t?

牧云@^-^@ 提交于 2019-12-07 05:30:46
问题 Say I have a class that owns a D3DDevice : class Thing { public: Thing() { D3D11CreateDevice(..., &device, ...); } ~Thing() { device->Release(); } private: ID3D11Device* device; }; From what I understand, I can use _com_ptr_t to ensure that the object gets deleted without my having to explicitly call Release() in the destructor. The problem though is that I can't figure out the correct syntax for the template. I could find hardly any information on _com_ptr_t , and the closest thing I could

Shall we treat BSTR type in COM as value or reference?

家住魔仙堡 提交于 2019-12-07 05:26:54
问题 From book ATL Internals , I knew BSTR is different from OLECHAR*, and there are CComBSTR and CString for BSTR. According MSDN Allocating and Releasing Memory for a BSTR, I knew memory management responsibility for caller/callee. Take this line from MSDN, HRESULT CMyWebBrowser::put_StatusText(BSTR bstr) I still do not know how to handle bstr properly in my implementation. Since I still have a basic question for BSTR -- should we treat bstr as a value (like int) or as a reference (like int*),

Opening Word-document (.doc) using C# causes COMException due to File Block Settings

会有一股神秘感。 提交于 2019-12-07 05:23:40
问题 I'm trying to open a really old (binary) Word-file using C#/.NET and Microsoft.Office.Interop.Word. Whenever I try to open this file using the snippet below, it fails with a COMException telling me that "You are attempting to open a file type that is blocked by your File Block settings in the Trust Center." This also used to happen when opening the same file in MS Word, but after adjusting the settings found in the Trust Center this now works just fine. However, I still cannot open the file