The main question has already been answered, but...
It is good that you called "free", but this is an unnecessary heap allocation that could lead to a memory fragmentation leak if you forget. Don't use the heap for stuff like this:
int m_Width, m_Height;
LPRECT rect = (LPRECT)malloc(sizeof(RECT)); // <- Why are you doing this?
if (GetWindowRect(m_Hwnd, rect))
{
m_Width = rect->right - rect->left;
m_Height = rect->bottom - rect->top;
}
else return; // Guaranteed memory leak if the function returns here. Where is the call to free?
free(rect); // <- ??
Also, why are you using malloc/free instead of new/delete?
In this case, the RECT is allocated on the stack and is automatically deallocated when the function goes out of scope:
int m_Width, m_Height;
RECT rect;
if (GetWindowRect(m_Hwnd,&rect))
{
m_Width = rect.right - rect.left;
m_Height = rect.bottom - rect.top;
}
else return;