While implementing my own IFilter I found that most likely some consumers will require marshalling from it. That is they QueryInterface() the IMarshal interface from my object.
Proxy/stubs from MIDL can't be used - MIDL will not compile the filter.idl file - the latter uses custom structures and MIDL doesn't know what to do with them. S...
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 ...
I want to add a method accepting IStream* to my COM interface. Here's the idl excerpt:
import "oaidl.idl";
import "ocidl.idl";
import "objidl.idl";//IStream is declared in this .idl file
[
uuid(uuidhere),
version(1.0)
]
library MyLibrary
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
[
object,
uuid(...
Hi, i am trying to call a method i have written in c# from vbscript.
I have followed just about all of the instructions i can find on the web and am still having problems.
Specifically i am getting the error, ActiveX component can't create object, Code: 800A01AD.
So far i have done the following..
1] Set ComVisible(true)
2] Registere...
I am working on a set of what are essentially plugins, which are COM servers. Each plugin has a set of configuration data which is managed by another component, the primary key to the configuration data is the plug-in's ProgID. When the plugin needs to access a configuration item, it makes a call and passes in its ProgID and the name of ...
I'm new to COM. What exactly is the advantage of replacing:
L"String"
with
CComBSTR(L"String")
I can see a changelist in the COM part of my .NET application where all strings are replaced in this way. Would like to know what is the need for this.
...
I have a .NET assembly. It happens to be written in C++/CLI. I am exposing a few objects via COM. Everything is working fine, but I cannot for the life of me figure out how to return an array of my own objects from a method. Every time I do, I get a type mismatch error at runtime. I can return an array of ints or strings just fine.
...
I'm confused about COM string assignments. Which of the following string assignment is correct. Why?
CComBSTR str;
.
.
Obj->str = L"" //Option1
OR should it be
Obj->str = CComBSTR(L"") //Option2
What is the reason
...
I have read that the following code causes memory leak. But did not understand why.
CComBSTR str;
pFoo->get_Bar(&str);
pFoo->get_Baf(&str);
How does it cause a leak when we are not allocating anything?
...
What is the correct syntax for instantiating a COM object in Delphi Prism using COM interop - new does not seem to do the job.
I've added it as a reference to the website project. Here is the relevant code:
method _Default.Button1_Click(sender: System.Object; e: System.EventArgs);
var
FModel: MarketBuilderLib.MarketBuilderModel;
be...
This MSDN article states that any ProgID must meet several formal requirements, length restriction included. However nothing is said about what happens if those are violated.
I found several places in our codebase where ProgIDs are longer than 39 characters, still everything seems to work allright for them, ProgIDFromCLSID() and CLSIDFr...
Whenever I put my component into COM+ and call CoCreateInstance() on the client the following happens:
the runtime instantiates the objecs (calls IClassFactory::CreateInstance())
the runtime calls QueryInterface() for the interface specified in teh CoCreateInstance() call
the runtime calls QueryInterface() for IdentityUnmarshal interfa...
When a COM+ application is created the wizard offers to choose between a library and a server application.
A server application is activated in a separate process and this can be used to cheaply interop 64-bit consumers with 32-bit in-proc COM components.
What's the use of library applications that are activated right in the caller pro...
I have a COM class CMyCOMServer implementing IMyInterface in one application, both with correct GUIDs. CMyCOMServer::QueryInterface will return S_OK (and cast itself to the right type) if IUnknown or IMyInterface is requested, otherwise it returns E_NOINTERFACE.
In another app on the same PC, I call:
HRESULT hr = ::CoCreateInstance(__u...
C#
namespace TestController
{
[ComVisible(true)]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IController {
void DoSomething();
}
[ComVisible(true), ClassInterface(ClassInterfaceType.None)]
public class ControllerImpl : IController {
public void DoSomethin...
I am making a C# DLL plugin for a EXE written in VB6. I do not have access to the source of the EXE. The DLL itself works and communicates fine with the EXE.
Here is the process for a event:
User issues command on EXE which then calls a function in the DLL, passing an object as a parameter
DLL processes data which sometimes takes a lo...
There's Another Company that ships the product that consumes IAnotherCompanyInterface. We want to ship a COM object that implements IAnotherCompanyInterface. That interface is not Automation-compatible, so the next easiest option to enable marshalling is using a proxy/stub. Another Company doesn't ship the proxy/stub and doesn't want to....
I have written a com component in .NET and if I try to take a lock on any object in any method (that is invoked by unmanaged code talking to my com component) I get an exception.
I do not have the exact text of the exception at this moment but it wasn't much helpful either.
So my question is under what circumstances a lock(syncObject) ...
According to this article if I register my COM object with either "Both" or "Free" threading model that object must be completely thread-safe. Specifically all accesses to global shared variables must be synchronized and all accesses to member variables must also be synchronized. That's a lot of effort.
Now I understand that being able ...
I have read a lot of articles on the net about releasing RCW's safely, and it seems to me that no one can agree on exactly what needs to be done in what order, so I'm asking you guys for your opinions. For example, one could do this:
object target = null;
try {
// Instantiate and use the target object.
// Assume we know what we ...