Hi, I'm a novice too. But I have had the same problem. So maybe I can give you a hint. As far as I know the best solution is to use the BSTR data type. This is not very complicated. There are only some special functions that you have to use: SysAllocString, SysFreeString, SysStringLen and some other ones. You could do it like this: IDL: GetStr([out] BSTR* str) Method implementation: STDMETHODIMP CAbc::GetStr(BSTR* str) { //Allocate memory for the BSTR str = SysAllocString("string for COM"); //Check wether allocation was successful if(str) return S_OK; else return E_FAIL; } And the caller: ... BSTR myBStr; HRESULT hr = Abc->GetStr(myBStr); if(FAILED(hr)) damned(); else { //Now you've got the string //Do with it what ever you want (but don't get rude...) //You can use it like a LPSTR as far as I know printf("My String: %s", myBStr); //example SetDlgItemText(IDC_EDIT, myBStr); //example //But now it is your responsability to free the memory! SysFreeString(myBStr); //That's it } ... I hope this was all correct. Try it. It should work. But maybe someone else can tell you more or correct my posting.
J
justanotherprogrammer
@justanotherprogrammer