How to pass string from C# to C++ (COM)
-
hi, I've a COM object created in C++ , used in C# . I need to pass a string to that COM method, but always when I send string from C# , only first character occurs on C++ side. COM Method: STDMETHODIMP Initialize(LPTSTR a, LPTSTR b); { cout << "a: " << a << " b:" << b << endl; .... } if I call this method on that COM object (wrapped in C#) IMyObject.Initialize("one", "two"); only thing i get in console is a:o b:t (instead of "a:one b:two") how can i get whole size of string ??
-
hi, I've a COM object created in C++ , used in C# . I need to pass a string to that COM method, but always when I send string from C# , only first character occurs on C++ side. COM Method: STDMETHODIMP Initialize(LPTSTR a, LPTSTR b); { cout << "a: " << a << " b:" << b << endl; .... } if I call this method on that COM object (wrapped in C#) IMyObject.Initialize("one", "two"); only thing i get in console is a:o b:t (instead of "a:one b:two") how can i get whole size of string ??
here you pass as array may be it solve ur problem
Sujit
-
hi, I've a COM object created in C++ , used in C# . I need to pass a string to that COM method, but always when I send string from C# , only first character occurs on C++ side. COM Method: STDMETHODIMP Initialize(LPTSTR a, LPTSTR b); { cout << "a: " << a << " b:" << b << endl; .... } if I call this method on that COM object (wrapped in C#) IMyObject.Initialize("one", "two"); only thing i get in console is a:o b:t (instead of "a:one b:two") how can i get whole size of string ??
Try to send StringBuilder instances from C# application..
Cheers, Suresh
-
hi, I've a COM object created in C++ , used in C# . I need to pass a string to that COM method, but always when I send string from C# , only first character occurs on C++ side. COM Method: STDMETHODIMP Initialize(LPTSTR a, LPTSTR b); { cout << "a: " << a << " b:" << b << endl; .... } if I call this method on that COM object (wrapped in C#) IMyObject.Initialize("one", "two"); only thing i get in console is a:o b:t (instead of "a:one b:two") how can i get whole size of string ??
-
hi, I've a COM object created in C++ , used in C# . I need to pass a string to that COM method, but always when I send string from C# , only first character occurs on C++ side. COM Method: STDMETHODIMP Initialize(LPTSTR a, LPTSTR b); { cout << "a: " << a << " b:" << b << endl; .... } if I call this method on that COM object (wrapped in C#) IMyObject.Initialize("one", "two"); only thing i get in console is a:o b:t (instead of "a:one b:two") how can i get whole size of string ??