CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2002
    Location
    .NET 3.5 VS2008
    Posts
    1,039

    Access violation Problem with BSTRs

    Hi gurus,

    Code:
    	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.

  2. #2
    Join Date
    May 2004
    Posts
    45

    Re: Access violation Problem with BSTRs

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured