How to convert LPWSTR to BSTR? LPWSTR is WCHAR *, and BSTR is OLECHAR *, OLECHAR is again of the WCHAR type, just gaining a listing? or do we need to make some extra effort? It shows the wrong error / warning error.
You do it like this:
BSTR pBstr = SysAllocString(szWCharString); // do something with the BSTR here ... SysFreeString(pBstr);
You must remember to free up the space used for the conversion by calling SysFreeString afterwards.
SysFreeString
BSTR consists of OLECHAR [] and the length information preceding the line. BSTR is a pointer to a part of OLECHAR []. But BSTR functions require length information (capacity and length).
You need the SysAllocString function to highlight the entire structure.
Source: https://habr.com/ru/post/1483284/More articles:JavaFx tableview sort really slow how to improve sorting speed like in java swing - javaRuby method for + = - ruby | fooobar.comCheck me out this javascript template - javascriptto find the intersection of two array structures in Matlab - algorithmWhy is std :: string / std :: map not recommended to be created on the heap? - c ++How to find dependent libraries - c ++How to update XML nodes with new values? - c #Removing thetag in validation summaries - cssis the best approach to finding a variable is a function? - javascriptcancan on a single page application - ruby-on-railsAll Articles