com

Controlling Skype via its Skype4COM.dll COM API

假装没事ソ 提交于 2019-12-18 13:28:52
问题 I'm working with the Skype4COM.dll COM API using C# and it works very well for all of the communication functionality we need. We are trying to put an easier to use interface on top of Skype that is baked into our application. My trouble lies in controlling or disabling which Skype windows to use and not use. The only Skype window I believe I'll need is the Skype video phone/conference window. I would like to hide and control every other window that Skype can present. I would even like to

C# + COM Interop, deterministic release

旧街凉风 提交于 2019-12-18 12:24:26
问题 COM objects usually have deterministic destruction: they are freed when the last reference is released. How is this handled in C# - COM Interop? The classes don't implement IDisposable , so I see no way to trigger an explicit IUnknown::Release. A casual test shows that unreferenced COM objects get collected lazily (i.e. the garbage collector is triggering the release). What should I do for OCM objects that need to be released aggresively? (e.g. holding large or shared critical ressources)?

How does COM select how to marshal an interface?

China☆狼群 提交于 2019-12-18 12:06:19
问题 As I get it there're three ways to implement marshalling in COM: typelib marshalling proxy/stub marshalling implementing IMarshal by the object now how does the component consumer (user) choose which one will be used? Does it decide on its own and use the preferred way or does it call some built-in function and it solves the problem for it? I currently experience the following: my component implements a custom interface ICustomInterface that is also implemented by a component from another

CoWaitForMultipleHandles API doesn't behave as documented

社会主义新天地 提交于 2019-12-18 12:01:17
问题 This was triggered by another question I was looking at. It might be too long to read, so please bear with me. Apparently, CoWaitForMultipleHandles does not behave as documented on MSDN. The code below (based upon the original question) is a console app, which starts an STA thread with a test Win32 window and tries post and to pump some messages. It does three different tests on CoWaitForMultipleHandles , all without COWAIT_WAITALL flag. Test #1 is aimed to verify this: COWAIT_INPUTAVAILABLE

Why can't we use “virtual inheritance” in COM?

本小妞迷上赌 提交于 2019-12-18 12:00:51
问题 I have read some vague statement that virtual inheritance doesn't provide the memory structure required by COM, so we have to use the normal inheritance. Virtual inheritance is invented to handle the diamond problem . Could someone show me an illustration of the difference of memory structure details between this two inherit approaches? And the key reason why virtual inheritance is not suitable for COM. A picture would be best. Many thanks. 回答1: COM interfaces are rather like JAVA interfaces

What is PVOID data type?

六月ゝ 毕业季﹏ 提交于 2019-12-18 11:49:53
问题 Can someone explain what PVOID is and how it is used in a function like: BOOL DoSomething(PVOID pMemPhy) 回答1: void pointer, same as void *pMemPhy aka "Pointer to something, but it's up to you to figure it out". BOOL DoSomething ( PVOID pMemPhy ) { strcpy((char *)pMemPhy, "I love buffer overflows!"); return TRUE; } 回答2: It's a void pointer -- a pointer to a memory address with no information about the type of the value that it is pointing to. For this reason, you must cast the pointer to a

Visual Studio 2010 64-bit COM Interop Issue

依然范特西╮ 提交于 2019-12-18 11:48:03
问题 I am trying to add a VC6 COM DLL to our VS2010RC C# solution. The DLL was compiled with the VC6 tools to create an x86 version and was compiled with the VC7 Cross-platform tools to generate a VC7 DLL. The x86 version of the assembly works fine as long as the consuming C# project's platform is set to x86. It doesn't matter whether the x64 or the x86 version of the DLL is actually registered. It works with both. If the platform is set to 'Any CPU' I receive a BadImageFormatException on the load

Converting a JPEG image to a byte array - COM exception

心不动则不痛 提交于 2019-12-18 11:47:18
问题 Using C#, I'm trying to load a JPEG file from disk and convert it to a byte array. So far, I have this code: static void Main(string[] args) { System.Windows.Media.Imaging.BitmapFrame bitmapFrame; using (var fs = new System.IO.FileStream(@"C:\Lenna.jpg", FileMode.Open)) { bitmapFrame = BitmapFrame.Create(fs); } System.Windows.Media.Imaging.BitmapEncoder encoder = new System.Windows.Media.Imaging.JpegBitmapEncoder(); encoder.Frames.Add(bitmapFrame); byte[] myBytes; using (var memoryStream =

Does assigning null remove all event handlers from an object?

[亡魂溺海] 提交于 2019-12-18 11:41:47
问题 I have defined new member in my class protected COMObject.Call call_ = null; This class has the following event handler that I subscribed to call_.Destructed += new COMObject.DestructedEventHandler(CallDestructedEvent); Will setting my member to null as following remove the event handler? call_ = null; or I have to unsubscribed with -=? 回答1: yes, you should use overloaded -= to unsubscribe an event. simply assigning a reference to null will not do that automatically. The object will still be

How do I import a COM object namespace/enumeration in Python?

强颜欢笑 提交于 2019-12-18 11:33:23
问题 I'm relatively new to programming/python, so I'd appreciate any help I can get. I want to save an excel file as a specific format using Excel through COM. Here is the code: import win32com.client as win32 def excel(): app = 'Excel' x1 = win32.gencache.EnsureDispatch('%s.Application' % app) ss = x1.Workbooks.Add() sh = ss.ActiveSheet x1.Visible = True sh.Cells(1,1).Value = 'test write' ss.SaveAs(Filename="temp.xls", FileFormat=56) x1.Application.Quit() if __name__=='__main__': excel() My