I think you need to use
GetWindowPlacement[
^] API.
The function will tell you the current state of the window. In you case, if the window is just stretched to the size of the desktop, your function will still return TRUE.
WINDOWPLACEMENT wp = {0};
wp.length = sizeof(WINDOWPLACEMENT);
if(::GetWindowPlacement(hForeGndWnd, &wp) && wp.showCmd & SW_SHOWMAXIMIZED)
return TRUE;
On the side note there are two possible bugs in your code. First, you need to set the cbSize member to sizeof(WINDOWINFO) before calling this function (wi.cbSize = sizeof(WINDOWINFO)). Second, you need to test the return code of GetWindowInfo