Need help to return string value from COM
-
I'm trying to create a .dll using ATL, which I want use in C#. Can anybody please guide me to create a simple method / function which takes string in input parameters and returns the same(string).. I tried a lot but always faced problem of returing string back to calling function in C#. I did the same with C++ class library successfully but when it comes to ATL its not the same. As I'm using other SDK API's in creation of .dll and I can't go with Class Library its having problem with "CLR and MTd". Which can't go together. Finally I decided to stick to ATL. Now please guide me to create the methods which I can use in C# to get the string value. Arun
-
I'm trying to create a .dll using ATL, which I want use in C#. Can anybody please guide me to create a simple method / function which takes string in input parameters and returns the same(string).. I tried a lot but always faced problem of returing string back to calling function in C#. I did the same with C++ class library successfully but when it comes to ATL its not the same. As I'm using other SDK API's in creation of .dll and I can't go with Class Library its having problem with "CLR and MTd". Which can't go together. Finally I decided to stick to ATL. Now please guide me to create the methods which I can use in C# to get the string value. Arun
Use the below signature for the COM method. Then use RCW to call this method from .Net
[id(1)] HRESULT ReturnString([in,out] BSTR stringValue);
cheers....MIlton KB