Thanks for the update Eri. That's a neat way and not obvious from what documentation I've read.
Quote Originally Posted by Eri523 View Post
I think it's worth noting that this leaks memory: The dynamically allocated rect is never released. Actually, there's no need to dynamically allocate it anyway. The reason why I dynamically allocated lpNativeText in Win32::GetWindowText_() ....
Ok but I didn't use dynamic allocation to mimic your example but because the help I read for GetWindowRect specified LPRECT (and I didn't see any use of "RECT and &rect")
I did have the following in my original Win32::GetWindowRect
Code:
  System::Drawing::Rectangle^ nrect = gcnew System::Drawing::Rectangle(rect->left,rect->top,rect->right-rect->left,rect->bottom-rect->top);
  delete rect;
  return nrect;
For some reason I didn't use it but can't now remember why... Am I right in thinking this would be ok from the GC POV?