com

COM - #include generated header vs #import generated tlb

人盡茶涼 提交于 2019-12-22 09:18:04
问题 I have many projects of which generate COM DLL's, these projects output the following: projectname_i.h projectname_i.c projectname_p.c projectname_i.tlb Then where another project consumes this DLL it is used like so: #import "projectname.tlb" named_guids no_namespace I want to change this to use include instead of import. The reason behind wanting to change from #import to #include is because I want to enable the /MP compiler switch to speed up build times. http://msdn.microsoft.com/en-us

COM - #include generated header vs #import generated tlb

人盡茶涼 提交于 2019-12-22 09:17:54
问题 I have many projects of which generate COM DLL's, these projects output the following: projectname_i.h projectname_i.c projectname_p.c projectname_i.tlb Then where another project consumes this DLL it is used like so: #import "projectname.tlb" named_guids no_namespace I want to change this to use include instead of import. The reason behind wanting to change from #import to #include is because I want to enable the /MP compiler switch to speed up build times. http://msdn.microsoft.com/en-us

WatiN “Unable to cast COM object” exception

*爱你&永不变心* 提交于 2019-12-22 08:47:49
问题 from time to time, my monitoring application dies for no obvious reason. It seems like "mshtml.HTMLDocument" resource isn't available. Anyone else experienced something similar? Thanks in advance. Error message: 14.04.2011 18:26:37 -> Test 1.2 (Subscriber type requests), error: Unable to cast COM object of type 'System.__ComObject' to interface type 'mshtml.HTMLDocument'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{3050F55F-98B5-11CF

From C#, open an arbitrary application

不羁岁月 提交于 2019-12-22 08:39:09
问题 Related question [stackoverflow] here. I'm trying to do the above, but I want to take the process one step further. I want to open an arbitrary file using the default editor for the file type. From that point, I want to allow my user to interact with the file as they would normally, or continue to work in my application. The extension is what happens after the user finishes editing. Is there a way I can capture a close (and ideally save) event from the external application and use that as a

The type library importer encountered an error during type verification

…衆ロ難τιáo~ 提交于 2019-12-22 07:05:42
问题 I am writing a C# application which has several COM references. When I attempt to build it I get the following error for some of them: c:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(1418,9): error MSB3303: Could not resolve COM reference "70850f66-869f-44a0-88e7-b0460a7e3bf3" version 0.1. The type library importer encountered an error during type verification. Try importing without class members. The application is still built and runs successfully. What does this error

What is the difference between a COM string (BSTR) and a .NET string?

穿精又带淫゛_ 提交于 2019-12-22 06:36:22
问题 Is it just the way the bytes are combined to "encode" the data? I'm curious because I wonder how an RCW automatically takes a .NET string and transforms it into a COM BSTR. I'm guessing it just forms a valid COM BSTR transformed from the .NET string. Related: Could I construct my own valid BSTR using a byte type in .NET? 回答1: The two string types are not related at all. A transformation has to occur to convert one type to another. A BSTR has a number of conventions that must be followed in

How could a member method delete the object?

余生长醉 提交于 2019-12-22 06:10:39
问题 I am currently studying COM and the following code confused me. STDMETHODIMP _(ULONG) ComCar::Release() { if(--m_refCount==0) delete this; // how could this "suicide" deletion be possible? return m_refCount; } I am wondering how could it be possible to delete an object instance within its member method? So I made the following experiment: class A { public: void Suicide(void); void Echo(void); char name; }; void A::Echo(void) { ::printf("echo = %c\n",name); } void A::Suicide(void) { delete

In what order should one release COM objects and garbage collect?

蹲街弑〆低调 提交于 2019-12-22 05:51:56
问题 There are lots of questions on SO regarding the releasing COM objects and garbage collection but nothing I could find that address this question specifically. When releasing COM objects (specifically Excel Interop in this case), in what order should I be releasing the reference and calling garbage collection? In some places (such as here) I have seen this: Marshall.FinalReleaseComObject(obj); GC.Collect(); GC.WaitForPendingFinalizers(); And in others (such as here) this: GC.Collect(); GC

In what order should one release COM objects and garbage collect?

馋奶兔 提交于 2019-12-22 05:51:07
问题 There are lots of questions on SO regarding the releasing COM objects and garbage collection but nothing I could find that address this question specifically. When releasing COM objects (specifically Excel Interop in this case), in what order should I be releasing the reference and calling garbage collection? In some places (such as here) I have seen this: Marshall.FinalReleaseComObject(obj); GC.Collect(); GC.WaitForPendingFinalizers(); And in others (such as here) this: GC.Collect(); GC

In Windows, is there any way to convert an errno into an HRESULT?

筅森魡賤 提交于 2019-12-22 05:28:12
问题 I know the HRESULT_FROM_WIN32 macro to convert a Win32 error code into an HRESULT, is there any way to do the conversion starting from an errno error? 回答1: In short, no. As of http://msdn.microsoft.com/en-us/library/5814770t%28v=vs.100%29.aspx The errno values are constants assigned to errno in the event of various error conditions. ERRNO.H contains the definitions of the errno values. However, not all the definitions given in ERRNO.H are used in 32-bit Windows operating systems. Some of the