Passing a BSTR parameter into a COM method.
-
Hi, I have to pass a BSTR string which is read from a xml file(using simple C-style fopen,fgetws methods) to a COM method. Within the COM method this BSTR string is to be passed further to a method that takes _bstr_t as a parameter. The problem arises when the BSTR string is to be passed further to the method contained within the COM method. The conversion from BSTR to _bstr_t converts only a portion of the string and not the complete string. Since _bstr_t is just a wrapper over BSTR, it must take BSTR and form a object of _bstr_t,but the object is not showing the complete string passed to it. How do I solve this problem?? Thanks and Regards, Abhishek. Learning is a never ending process of Life.
-
Hi, I have to pass a BSTR string which is read from a xml file(using simple C-style fopen,fgetws methods) to a COM method. Within the COM method this BSTR string is to be passed further to a method that takes _bstr_t as a parameter. The problem arises when the BSTR string is to be passed further to the method contained within the COM method. The conversion from BSTR to _bstr_t converts only a portion of the string and not the complete string. Since _bstr_t is just a wrapper over BSTR, it must take BSTR and form a object of _bstr_t,but the object is not showing the complete string passed to it. How do I solve this problem?? Thanks and Regards, Abhishek. Learning is a never ending process of Life.
Try using the BSTR in the _bstr_t's constructor, e.g. _bstr_t stuff(/*BSTR here*/); This should solve your problem When I was young my mother told me to clean up my room, I told her -1!