Debug exception from GetTextExtent call: VS15

  • Thread starter Thread starter BruceVx
  • Start date Start date
B

BruceVx

Guest
Hello, I’m getting an exception running an MFC C++ program in debug under VS15. The problem occurs at a GetTextExtent() statement. If I tell the debugger to proceed, the run continues OK, and if I run in Release, the program runs fine.

I’d like to find out what’s causing the exception. One possibility is that all my GUI-related text strings are type wchar_t*, and the argument of the GetTextExtent() is type wchar_t* also. However, in MSDN it appears that this function accepts Cstrings. Is this possibly my problem, ie. should I change the string types to Cstring (and for all the other WIN32 GUI-related functions also, presumably…. Aaargh!!) Or is GetTextExtent() overloaded for wide chars? The documentation I can find isn’t over clear on this.

I can't see anything else that might be causing the situation. The string being passed in looks fine, the string buffer is plenty big enough. The statement is simply determining the string length and assigning to an integer, ie:

int StrExt_x = GetTextExtent (txtstr).cx ;

Thanks in advance.


bv

Continue reading...
 
Back
Top