Using SendMessageW function I am passing c# string as a parameter to c++ function. I am typecasting to CString in c++ but it's value is empty. Please check below code and provide solution
-----------------------c# code ------------------
public unsafe IntPtr Testing()
{
string string_aux = "Stringtochange";
void* pt = Marshal.StringToBSTR(string_aux).ToPointer();
IntPtr ab = new IntPtr(pt);
return ab;
}
public void GetValue()
{
SendMessageW(utilityHandle1, TVM_GETITEMHEIGHT, handle,Testing());
}
--------------------- C++ code --------------
CString *st = (CString*)lParam;
MessageBox(NULL,*st,L"stringvalue",NULL);
Here *st value is empty.