+ case WM_QUERYFRAMECTLCOUNT:
+ if(pWnd && pWnd->m_fnOldWndProc)
+ {
+ USHORT uItemCount = SHORT1FROMMR(pWnd->m_fnOldWndProc(hWnd, ulMsg, wParam, lParam));
+
+ rc = MRFROMSHORT(uItemCount);
+ }
+ break;
+
+ case WM_FORMATFRAME:
+/////////////////////////////////////////////////////////////////////////////////
+// Applications that subclass frame controls may find that the frame is already
+// subclassed the number of frame controls is variable.
+// The WM_FORMATFRAME and WM_QUERYFRAMECTLCOUNT messages must always be
+// subclassed by calling the previous window procedure and modifying its result.
+////////////////////////////////////////////////////////////////////////////////
+ {
+ int nItemCount;
+ int i;
+ PSWP pSWP = NULL;
+ RECTL vRectl;
+ RECTL vRstb;
+ RECTL vRtlb;
+ int nHeight = 0;
+ int nHeight2 = 0;
+ int nWidth = 0;
+
+ pSWP = (PSWP)PVOIDFROMMP(wParam);
+ nItemCount = SHORT1FROMMR(pWnd->m_fnOldWndProc(hWnd, ulMsg, wParam, lParam));
+ if(pWnd->m_frameStatusBar)
+ {
+ ::WinQueryWindowRect(pWnd->m_frameStatusBar->GetHWND(), &vRstb);
+ pWnd->m_frameStatusBar->GetSize(NULL, &nHeight);
+ }
+ if(pWnd->m_frameToolBar)
+ {
+ ::WinQueryWindowRect(pWnd->m_frameToolBar->GetHWND(), &vRtlb);
+ pWnd->m_frameToolBar->GetSize(&nWidth, &nHeight2);
+ }
+ ::WinQueryWindowRect(pWnd->m_hFrame, &vRectl);
+ ::WinMapWindowPoints(pWnd->m_hFrame, HWND_DESKTOP, (PPOINTL)&vRectl, 2);
+ ::WinCalcFrameRect(pWnd->m_hFrame, &vRectl, TRUE);
+ ::WinMapWindowPoints(HWND_DESKTOP, pWnd->m_hFrame, (PPOINTL)&vRectl, 2);
+ for(i = 0; i < nItemCount; i++)
+ {
+ if(pWnd->m_hWnd && pSWP[i].hwnd == pWnd->m_hWnd)
+ {
+ if (pWnd->m_frameToolBar && pWnd->m_frameToolBar->GetWindowStyleFlag() & wxTB_HORIZONTAL)
+ {
+ pSWP[i].x = vRectl.xLeft;
+ pSWP[i].y = vRectl.yBottom + nHeight;
+ pSWP[i].cx = vRectl.xRight - vRectl.xLeft;
+ pSWP[i].cy = vRectl.yTop - vRectl.yBottom - (nHeight + nHeight2);
+ }
+ else
+ {
+ pSWP[i].x = vRectl.xLeft + nWidth;
+ pSWP[i].y = vRectl.yBottom + nHeight;
+ pSWP[i].cx = vRectl.xRight - (vRectl.xLeft + nWidth);
+ pSWP[i].cy = vRectl.yTop - vRectl.yBottom - nHeight;
+ }
+ pSWP[i].fl = SWP_SIZE | SWP_MOVE | SWP_SHOW;
+ pSWP[i].hwndInsertBehind = HWND_TOP;
+ }
+ }
+ bProcessed = true;
+ rc = MRFROMSHORT(nItemCount);
+ }
+ break;
+
+ default:
+ if(pWnd && pWnd->m_fnOldWndProc)
+ rc = pWnd->m_fnOldWndProc(hWnd, ulMsg, wParam, lParam);
+ else
+ rc = ::WinDefWindowProc(hWnd, ulMsg, wParam, lParam);
+ }
+ return rc;
+} // end of wxFrameMainWndProc
+
+MRESULT EXPENTRY wxFrameWndProc(
+ HWND hWnd
+, ULONG ulMsg
+, MPARAM wParam
+, MPARAM lParam
+)
+{
+ //
+ // Trace all ulMsgs - useful for the debugging
+ //
+ HWND parentHwnd;
+ wxFrame* pWnd = NULL;
+
+ parentHwnd = WinQueryWindow(hWnd,QW_PARENT);
+ pWnd = (wxFrame*) wxFindWinFromHandle((WXHWND) hWnd);
+
+ //
+ // When we get the first message for the HWND we just created, we associate
+ // it with wxWindow stored in wxWndHook
+ //
+
+ MRESULT rc = (MRESULT)0;
+
+ //
+ // Stop right here if we don't have a valid handle in our wxWindow object.
+ //
+ if (pWnd && !pWnd->GetHWND())
+ {
+ pWnd->SetHWND((WXHWND) hWnd);
+ rc = pWnd->OS2DefWindowProc(ulMsg, wParam, lParam );
+ pWnd->SetHWND(0);