HWND hwndChild = WinWindowFromID(hWnd, SHORT1FROMMP( mp1)); if (hwndChild)
HWND hwndChild = WinWindowFromID( hwnd, SHORT1FROMMP( mp1)); if( hwndChild)
MRESULT EXPENTRY fnwpNSWindow( HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2){   MRESULT popupHandlingResult;   if( nsWindow::DealWithPopups(msg, &popupHandlingResult) )      return popupHandlingResult;    // Get the window which caused the event and ask it to process the message    nsWindow *someWindow = nsWindow::GetNSWindowPtr(hWnd);    // XXX This fixes 50208 and we are leaving 51174 open to further investigate    // why we are hitting this assert    if (nsnull == someWindow) {      NS_ASSERTION(someWindow, "someWindow is null, cannot call any CallWindowProc");            return ::WinDefWindowProc(hWnd, msg, mp1, mp2);    }   // Messages which get re-routed if their source was an nsWindow   // (it's very bad to reroute messages whose source isn't an nsWindow,   // listboxes with scrollbars for example would break)   switch( msg)   {      case WM_CONTROL:      case WM_HSCROLL:      case WM_VSCROLL: // !! potential problems here if canvas children      {         // assume parent == owner, true for our creations         HWND hwndChild = WinWindowFromID(hWnd, SHORT1FROMMP( mp1));         if (hwndChild)         {            nsWindow *w = nsWindow::GetNSWindowPtr(hwndChild);            if (w)               someWindow = w;         }         break;      }   }    // hold on to the window for the life of this method, in case it gets    // deleted during processing. yes, it's a double hack, since someWindow    // is not really an interface.    nsCOMPtr<nsISupports> kungFuDeathGrip;    if (!someWindow->mIsDestroying) // not if we're in the destructor!      kungFuDeathGrip = do_QueryInterface((nsBaseWidget*)someWindow);   MRESULT retValue;   if (PR_TRUE == someWindow->ProcessMessage(msg, mp1, mp2, &retValue)) {       return retValue;   }   if (someWindow->GetPrevWP())      return (someWindow->GetPrevWP()) (hWnd, msg, mp1, mp2);   else      return ::WinDefWindowProc(hWnd, msg, mp1, mp2);}