Home » Category » Microsoft Visual C & C++

Microsoft Visual C & C++: Access violation Problem with BSTRs

202| Sat, 09 Feb 2008 00:27:00 GMT| nelo| Comments (1)
Hi gurus,

if (bstrParam == NULL)
{
CString strOutput("");
return strOutput;
}
else
{
CString strOutput(bstrParam);
return strOutput;
}

Hi gurus I think this is a simple question... but how can I test the value of bstrParam further. I'm getting a problem with the line that says ...CString strOutput(bstrParam) when bstrParam is not properly initialised. How can I test for this? In the debug window bstrParam is 0xcccccccc or something like that.

Thanks.

Keywords & Tags: access, violation, bstrs, microsoft, visual c++, vc

URL: http://www.7prog.com/visual-c-c++/10195/
 
«« Prev - Next »» 1 helpful answers below.
Maybe IsBadReadPtr?

from MSDN:

IsBadReadPtr

The IsBadReadPtr function verifies that the calling process has read access to the specified range of memory.

BOOL IsBadReadPtr(
const VOID* lp,
UINT_PTR ucb
);

Parameters
lp
[in] Pointer to the first byte of the memory block.
ucb
[in] Size of the memory block, in bytes. If this parameter is zero, the return value is zero.

thingol | Sun, 11 Nov 2007 00:55:00 GMT |

Microsoft Visual C & C++ Hot Answers

Microsoft Visual C & C++ New questions

Microsoft Visual C & C++ Related Categories