home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_144 / 5.ddi / RWCDEMO.ZIP / RWCDEMO.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  20.3 KB  |  577 lines

  1. // (C) Copyright 1991, 1992 by Borland International
  2.  
  3. #define STRICT
  4. #include <windows.h>
  5. #include <stdlib.h>
  6. #include <string.h>
  7. #if defined( BWCC)
  8. #include <bwcc.h>
  9. #else
  10. #define IDHELP 210
  11. #endif
  12. #include "rwcdemo.h"
  13. #include "rwcdlg.h"
  14.  
  15. #define TextStart 200
  16.  
  17.  
  18. static char szNotImplemented[] = "Feature Not Implemented";
  19. static char szDemoApp[] = "RWCDemo";
  20. HMENU   hMenuInit;
  21.  
  22.  
  23. HBITMAP bmpStatusLine;
  24. HBITMAP bmpStatusBar;
  25.  
  26. HINSTANCE  WinApp::hInstance;
  27. HINSTANCE  WinApp::hPrevInst;
  28. int        WinApp::cmdShow;
  29. HWND      WinApp::hWndClient;
  30. TMDIChildWindow *WinApp::currentWindow;
  31. UINT    wm_DrawStatusLine;
  32.  
  33. int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst, LPSTR, int cmdShow)
  34. {
  35.         HACCEL  hAccel;
  36.         HWND    hwndFrame;
  37.         MSG     msg;
  38.         WNDCLASS        wndClass;
  39.  
  40.         WinApp::hInstance = hInstance;
  41.         WinApp::hPrevInst = hPrevInst;
  42.         WinApp::cmdShow = cmdShow;
  43.         WinApp::currentWindow = NULL;
  44.  
  45.         if (!WinApp::hPrevInst)
  46.         {
  47.                 wndClass.style          = CS_HREDRAW | CS_VREDRAW;
  48.                 wndClass.lpfnWndProc    = FrameWndProc;
  49.                 wndClass.cbClsExtra     = 0;
  50.                 wndClass.cbWndExtra     = 0;
  51.                 wndClass.hInstance      = hInstance;
  52.                 wndClass.hIcon          = LoadIcon(WinApp::hInstance, MAKEINTRESOURCE(ico_RWCDemo));
  53.                 wndClass.hCursor        = LoadCursor(NULL, IDC_ARROW);
  54.                 wndClass.hbrBackground  = (HBRUSH)(COLOR_APPWORKSPACE + 1);
  55.                 wndClass.lpszMenuName   = NULL;
  56.                 wndClass.lpszClassName  = "MDIFrame";
  57.  
  58.                 RegisterClass(&wndClass);
  59.  
  60.         }
  61.  
  62.         hMenuInit       = LoadMenu(WinApp::hInstance, MAKEINTRESOURCE(100));
  63.         hAccel  = LoadAccelerators(WinApp::hInstance, MAKEINTRESOURCE(acc_Main));
  64.         wm_DrawStatusLine = RegisterWindowMessage("RWCDrawStatusLine");
  65.         hwndFrame = CreateWindow("MDIFrame", "RWCDemo",
  66.                         WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
  67.                         CW_USEDEFAULT, CW_USEDEFAULT,
  68.                         CW_USEDEFAULT, CW_USEDEFAULT,
  69.                         NULL, hMenuInit, hInstance, NULL);
  70.  
  71.         WinApp::hWndClient = GetWindow(hwndFrame, GW_CHILD);
  72.  
  73.         ShowWindow(hwndFrame, WinApp::cmdShow);
  74.         UpdateWindow(hwndFrame);
  75.  
  76.         while (GetMessage(&msg, NULL, 0, 0))
  77.                 if (!TranslateMDISysAccel(WinApp::hWndClient, &msg) &&
  78.                         !TranslateAccelerator(hwndFrame, hAccel, &msg))
  79.                 {
  80.                         TranslateMessage(&msg);
  81.                         DispatchMessage(&msg);
  82.                 }
  83.         return msg.wParam;
  84. }
  85.  
  86. void NewWindow(TMDIChildWindow* window)
  87. {
  88.         MDICREATESTRUCT mdiCreate;
  89.  
  90.         mdiCreate.szClass = window->className();
  91.         mdiCreate.szTitle = window->title;
  92.         mdiCreate.hOwner = WinApp::hInstance;
  93.         mdiCreate.x = CW_USEDEFAULT;
  94.         mdiCreate.y = CW_USEDEFAULT;
  95.         mdiCreate.cx = CW_USEDEFAULT;
  96.         mdiCreate.cy = CW_USEDEFAULT;
  97.         mdiCreate.style = 0;
  98.         mdiCreate.lParam = NULL;
  99.         WinApp::currentWindow = window;
  100.  
  101.         SendMessage(WinApp::hWndClient, WM_MDICREATE, 0,
  102.                 (LONG) (LPMDICREATESTRUCT) &mdiCreate);
  103. }
  104.  
  105. int ExecuteDialog(HWND hWindow, TDialog *d)
  106. {
  107.   return DialogBoxParam(WinApp::hInstance, d->name, hWindow, d->dialogFunc, (LONG) (void far *) d);
  108. }
  109.  
  110. int DoCommands(HWND hWindow, int Command, HWND hWndSource, UINT Notification)
  111. {
  112.         TDialog *d;
  113.         int FileType;
  114.  
  115.         switch(Command)
  116.         {
  117.                 case cm_Exit:
  118.                         //Iterate through all child windows.  If still can close then
  119.                         PostQuitMessage(0);
  120.                         return 0;
  121.         case cm_Open:
  122.             char szFileName[ fsFileSpec + 1];
  123.  
  124.             strcpy( szFileName, "*.*");
  125.             d = new TFileOpen(&FileType, szFileName);
  126.                         if ( ExecuteDialog(hWindow, d) == IDOK)
  127.                         {
  128. #if defined (BWCC)
  129.                                 BWCCMessageBox(GetFocus(), szNotImplemented, szDemoApp, MB_OK);
  130. #else
  131.                                 MessageBox(GetFocus(), szNotImplemented, szDemoApp, MB_OK);
  132. #endif
  133.                         }
  134.                         delete d;
  135.                         return 0;
  136.  
  137.                 case cm_New:
  138.                         d = new TFileNew(&FileType);
  139.                         if (ExecuteDialog(hWindow, d) == IDOK)
  140.                                 switch(FileType)
  141.                                 {
  142.                                         case ScribbleWindow:
  143.                                                 NewWindow(new TScribbleWindow("Untitled"));
  144.                                                 break;
  145.                                         case GraphWindow:
  146.                                                 NewWindow(new TShapeWindow("Untitled"));
  147.                                                 break;
  148.                                         default:
  149.                                                 NewWindow(new TEditWindow("Untitled"));
  150.                                                 break;
  151.  
  152.                                 }
  153.                         delete d;
  154.                         return 0;
  155.                 case cm_SaveAs:
  156.                         d = new TDialog(dlg_SaveAs);
  157.  
  158.                         if ( ExecuteDialog(hWindow, d) == IDOK)
  159.                         {
  160. #if defined (BWCC)
  161.                                 BWCCMessageBox(GetFocus(), szNotImplemented, szDemoApp, MB_OK);
  162. #else
  163.                                 MessageBox(GetFocus(), szNotImplemented, szDemoApp, MB_OK);
  164. #endif
  165.                         }
  166.                         delete d;
  167.                         return 0;
  168.  
  169.                 case cm_Print:
  170.                         d = new TDialog(dlg_Print);
  171.                         ExecuteDialog(hWindow, d);
  172.                         delete d;
  173. #if defined (BWCC)
  174.                         BWCCMessageBox(GetFocus(), szNotImplemented, szDemoApp, MB_OK);
  175. #else
  176.                         MessageBox(GetFocus(), szNotImplemented, szDemoApp, MB_OK);
  177. #endif
  178.                         return 0;
  179.  
  180.                 case cm_About_CUA:
  181.                         d = new TDialog(dlg_About);
  182.                         ExecuteDialog(hWindow, d);
  183.                         return 0;
  184.  
  185.                 case cm_Directories:
  186.                         d = new TDialog(dlg_Directories);
  187.                         ExecuteDialog(hWindow, d);
  188. #if defined (BWCC)
  189.                         BWCCMessageBox(GetFocus(), szNotImplemented, szDemoApp, MB_OK);
  190. #else
  191.                         MessageBox(GetFocus(), szNotImplemented, szDemoApp, MB_OK);
  192. #endif
  193.                         return 0;
  194.  
  195.                 case cm_Preferences:
  196.                         d = new TDialog(dlg_Preferences);
  197.                         ExecuteDialog(hWindow, d);
  198. #if defined (BWCC)
  199.                         BWCCMessageBox(GetFocus(), szNotImplemented, szDemoApp, MB_OK);
  200. #else
  201.                         MessageBox(GetFocus(), szNotImplemented, szDemoApp, MB_OK);
  202. #endif
  203.                         return 0;
  204.  
  205.                 case cm_Mouse:
  206.                         d = new TDialog(dlg_Mouse);
  207.                         ExecuteDialog(hWindow, d);
  208. #if defined (BWCC)
  209.                         BWCCMessageBox(GetFocus(), szNotImplemented, szDemoApp, MB_OK);
  210. #else
  211.                         MessageBox(GetFocus(), szNotImplemented, szDemoApp, MB_OK);
  212. #endif
  213.                         return 0;
  214.                 case cm_Options_Open:
  215.                         d = new TDialog(dlg_Options_Open);
  216.                         ExecuteDialog(hWindow, d);
  217.                         return 0;
  218.  
  219.                 case cm_Options_Save:
  220. #if defined (BWCC)
  221.                         BWCCMessageBox(GetFocus(), szNotImplemented, szDemoApp, MB_OK);
  222. #else
  223.                         MessageBox(GetFocus(), szNotImplemented, szDemoApp, MB_OK);
  224. #endif
  225.                         return 0;
  226.  
  227.                 case cm_Options_SaveAs:
  228.                         d = new TDialog(dlg_Options_SaveAs);
  229.                         ExecuteDialog(hWindow, d);
  230. #if defined (BWCC)
  231.                         BWCCMessageBox(GetFocus(), szNotImplemented, szDemoApp, MB_OK);
  232. #else
  233.                         MessageBox(GetFocus(), szNotImplemented, szDemoApp, MB_OK);
  234. #endif
  235.                         return 0;
  236.  
  237.                 case cm_Tile:
  238.                   SendMessage(WinApp::hWndClient, WM_MDITILE, 0, 0L);
  239.                   return 0;
  240.                 case cm_Cascade:
  241.                   SendMessage(WinApp::hWndClient, WM_MDICASCADE, 0, 0L);
  242.                   return 0;
  243.                 case cm_ArrangeIcons:
  244.                   SendMessage(WinApp::hWndClient, WM_MDIICONARRANGE, 0, 0L);
  245.                   return 0;
  246.  
  247.                 default:
  248.                         HWND hChildWnd = (HWND) (SendMessage(WinApp::hWndClient,
  249.                                 WM_MDIGETACTIVE, 0, NULL));
  250.  
  251.                         if (IsWindow(hChildWnd))
  252.                                 SendMessage(hChildWnd, WM_COMMAND, Command, MAKELONG( hWndSource, Notification));
  253.                         break;
  254.         }
  255.         return 0;
  256. }
  257.  
  258. void DoSize(HWND hWindow)
  259. {
  260.         RECT rect;
  261.         HDC DC, srcDC, destDC;
  262.         HBITMAP bmp;
  263.         HANDLE oldSrc, oldDest;
  264.  
  265.         GetClientRect(hWindow, &rect);
  266.         MoveWindow(WinApp::hWndClient, 0, 0, rect.right, rect.bottom - 20, 1);
  267.         InvalidateRect(hWindow, NULL, 1);
  268.         DC = GetDC(hWindow);
  269.         srcDC = CreateCompatibleDC(DC);
  270.         destDC = CreateCompatibleDC(DC);
  271.         ReleaseDC(hWindow, DC);
  272.  
  273.         bmp = LoadBitmap(WinApp::hInstance, MAKEINTRESOURCE(bmp_StatusLine));
  274.         oldSrc = SelectObject(srcDC, bmp);
  275.         if (bmpStatusLine)
  276.           DeleteObject(bmpStatusLine);
  277.         bmpStatusLine = CreateCompatibleBitmap(DC, rect.right, 20);
  278.         oldDest = SelectObject(destDC, bmpStatusLine);
  279.         BitBlt(destDC, 0, 0, 5, 20, srcDC, 0, 0, SRCCOPY);
  280.         StretchBlt(destDC, 5, 0, rect.right - 5, 20,
  281.                            srcDC, 6, 0, 20, 20, SRCCOPY);
  282.         BitBlt(destDC, rect.right - 5, 0, 5, 20, srcDC, 59, 0, SRCCOPY);
  283.         SelectObject(srcDC, oldSrc);
  284.         SelectObject(destDC, oldDest);
  285.         DeleteDC(srcDC);
  286.         DeleteDC(destDC);
  287.         DeleteObject(bmp);
  288. }
  289.  
  290. void BlastStatusLine(HWND hWindow, HDC PaintDC)
  291. {
  292.         HDC memDC;
  293.         RECT clientRect;
  294.         HANDLE oldBmp;
  295.  
  296.         GetClientRect(hWindow, &clientRect);
  297.         memDC = CreateCompatibleDC(PaintDC);
  298.         oldBmp = SelectObject(memDC, bmpStatusLine);
  299.         BitBlt(PaintDC, 0, clientRect.bottom - 20,
  300.                 clientRect.right - clientRect.left, 20,
  301.                 memDC, 0, 0, SRCCOPY);
  302.         SelectObject(memDC, bmpStatusBar);
  303.         BitBlt(PaintDC, 40, clientRect.bottom - 20,
  304.                                         10, 20, memDC, 0, 0, SRCCOPY);
  305.         BitBlt(PaintDC, 100, clientRect.bottom - 20,
  306.                                         10, 20, memDC, 0, 0, SRCCOPY);
  307.         BitBlt(PaintDC, TextStart, clientRect.bottom - 20,
  308.                                         10, 20, memDC, 0, 0, SRCCOPY);
  309.         SelectObject(memDC, oldBmp);
  310.         DeleteDC(memDC);
  311. }
  312.  
  313. void DoPaint(HWND hWindow)
  314. {
  315.         HDC PaintDC;
  316.         PAINTSTRUCT PS;
  317.  
  318.         PaintDC = BeginPaint(hWindow, &PS);
  319.         BlastStatusLine(hWindow, PaintDC);
  320.         EndPaint(hWindow, &PS);
  321. }
  322.  
  323. #define WindowMenuPos 4
  324. #define EditFirst                 cm_Undo
  325. #define EnvironmentFirst          cm_Preferences
  326. #define FileFirst                 cm_New
  327. #define HelpFirst                 cm_Index
  328. #define OptionFirst               cm_Directories
  329. #define ViewFirst                 cm_All
  330. #define WindowFirst               cm_Tile
  331. #define StatusLineHeight        20
  332. int CurrentID;
  333. HMENU CurrentPopup;
  334.  
  335. void drawStatusLine(HWND hWindow)
  336. {
  337.   HDC DC;
  338.   RECT Rect;
  339.   char Str[128];
  340.   int StrID;
  341.  
  342.   if (CurrentID)
  343.   {
  344.         switch(CurrentID)
  345.         {
  346.           case cm_New: StrID = sth_FileNew; break;
  347.           case cm_Open: StrID = sth_FileOpen; break;
  348.           case cm_Save: StrID = sth_FileSave; break;
  349.           case cm_SaveAs: StrID = sth_FileSaveAs; break;
  350.           case cm_Print: StrID = sth_FilePrint; break;
  351.           case cm_Exit: StrID = sth_FileExit; break;
  352.           case cm_Undo: StrID = sth_EditUndo; break;
  353.           case cm_Cut: StrID = sth_EditCut; break;
  354.           case cm_Copy: StrID = sth_EditCopy; break;
  355.           case cm_Paste: StrID = sth_EditPaste; break;
  356.           case cm_Delete: StrID = sth_EditDelete; break;
  357.           case cm_Clear: StrID = sth_EditClear; break;
  358.           case cm_Options_Open: StrID = sth_OptionsOpen; break;
  359.           case cm_All: StrID = sth_ViewAll; break;
  360.           case cm_By: StrID = sth_ViewBy; break;
  361.           case cm_Some: StrID = sth_ViewSome; break;
  362.           case cm_Directories: StrID = sth_OptionsDirectory; break;
  363.           case cm_Options_Save: StrID = sth_OptionsSave; break;
  364.           case cm_Options_SaveAs: StrID = sth_OptionsSaveAs; break;
  365.           case cm_Preferences: StrID = sth_EnvironmentPreferences; break;
  366.           case cm_Mouse: StrID = sth_EnvironmentMouse; break;
  367.           case cm_Tile: StrID = sth_WindowTile; break;
  368.           case cm_Cascade: StrID = sth_WindowCascade; break;
  369.           case cm_ArrangeIcons: StrID = sth_WindowArrange; break;
  370.           case cm_CloseAll: StrID = sth_WindowCloseAll; break;
  371.           case cm_Index: StrID = sth_HelpIndex; break;
  372.           case cm_Topic_Search: StrID = sth_HelpTopic; break;
  373.           case cm_Glossary: StrID = sth_HelpGlossary; break;
  374.           case cm_Using_Help: StrID = sth_HelpUsing; break;
  375.           case cm_About_CUA: StrID = sth_HelpAbout; break;
  376.           default:
  377.                 return;
  378.         }
  379.   }
  380.   else
  381.   if (CurrentPopup)
  382.   {
  383.         switch(GetMenuItemID(CurrentPopup, 0))
  384.         {
  385.           case FileFirst: StrID = sth_File; break;
  386.           case EditFirst: StrID = sth_Edit; break;
  387.           case ViewFirst: StrID = sth_View; break;
  388.           case WindowFirst: StrID = sth_Window; break;
  389.           case OptionFirst: StrID = sth_Option; break;
  390.           case EnvironmentFirst: StrID = sth_OptionsEnvironment; break;
  391.           case HelpFirst: StrID = sth_Help; break;
  392.           default: return;
  393.         }
  394.   }
  395.  
  396.   DC = GetDC(hWindow);
  397.   BlastStatusLine(hWindow, DC);
  398.   if ((CurrentPopup) || (CurrentID != 0))
  399.   {
  400.         LOGFONT lf;
  401.         HFONT   hSmall, hOld;
  402.         int     TextHeight;
  403.  
  404.         // get a slightly smaller font
  405.  
  406.         hOld = (HFONT) GetStockObject( ANSI_VAR_FONT);
  407.         if ( hOld)
  408.         {
  409.                 GetObject( hOld, sizeof( LOGFONT), (LPSTR) &lf);
  410.                 if ( lf.lfHeight > 3)
  411.                   lf.lfHeight -= 3;
  412.                 lf.lfWidth = 0;
  413.                 hSmall = CreateFontIndirect( &lf);
  414.         }
  415.         else
  416.                 hSmall = 0;
  417.         if ( hSmall)
  418.                 hOld = (HFONT) SelectObject( DC, hSmall);
  419.         else
  420.                 hOld = 0;
  421.  
  422.         LoadString(WinApp::hInstance, StrID, Str, sizeof(Str));
  423.         GetClientRect(hWindow, &Rect);
  424.         SetBkColor(DC, RGB(192, 192, 192));
  425.         TextHeight = (int) HIWORD( GetTextExtent( DC, Str, 1) );
  426.         TextOut(DC, TextStart+10,
  427.           Rect.bottom - StatusLineHeight + ( ( StatusLineHeight - TextHeight ) / 2),
  428.           Str, strlen(Str));
  429.         if ( hOld)
  430.                 SelectObject( DC, hOld);
  431.         if ( hSmall)
  432.                 DeleteObject( hSmall);
  433.   }
  434.   ReleaseDC(hWindow, DC);
  435. }
  436.  
  437. void menuSelect(HWND hWindow, WORD wParam, LONG lParam)
  438. {
  439.  
  440.   if (LOWORD(lParam) == 0x0FFFF)
  441.   {
  442.         CurrentPopup = 0;
  443.         CurrentID = 0;
  444.   }
  445.   else
  446.   if (LOWORD(lParam) & MF_POPUP)
  447.   {
  448.         CurrentPopup = (HMENU) wParam;
  449.         CurrentID = 0;
  450.   }
  451.   else
  452.         CurrentID = wParam;
  453.   PostMessage(hWindow,wm_DrawStatusLine, 0, 0);
  454. }
  455.  
  456. LRESULT CALLBACK _export FrameWndProc(HWND hWindow, UINT message, WPARAM wParam, LPARAM lParam)
  457. {
  458.         int rc;
  459.  
  460.         switch(message)
  461.         {
  462.                 case WM_CREATE:
  463.                         CLIENTCREATESTRUCT clientCreate;
  464.                         clientCreate.idFirstChild = 2000;
  465.                         clientCreate.hWindowMenu = GetSubMenu(hMenuInit, WindowMenuPos);
  466.                         WinApp::hWndClient = CreateWindow("MDICLIENT", NULL,
  467.                                 WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE,
  468.                                 0, 0, 0, 0, hWindow, (HMENU) 1, WinApp::hInstance,
  469.                                 (LPSTR) &clientCreate);
  470.                         bmpStatusBar = LoadBitmap(WinApp::hInstance, MAKEINTRESOURCE(bmp_StatusBar));
  471.                         return 0;
  472.  
  473.                 case WM_SIZE:
  474.                         DoSize(hWindow);
  475.                         return 0;
  476.  
  477.                 case WM_PAINT:
  478.                         DoPaint(hWindow);
  479.                         return 0;
  480.  
  481.                 case WM_COMMAND:
  482.                         rc = DoCommands(hWindow, (int) wParam, (HWND) lParam, HIWORD( lParam) );
  483.                         if (rc)
  484.                           return rc;
  485.                         break;
  486.                 case WM_DESTROY:
  487.                         if (bmpStatusLine)
  488.                                 DeleteObject(bmpStatusLine);
  489.                         DeleteObject(bmpStatusBar);
  490.                         PostQuitMessage(0);
  491.                         return 0;
  492.  
  493.                 case WM_MENUSELECT:
  494.                         menuSelect(hWindow, wParam, lParam);
  495.                         return 0;
  496.  
  497.                 case WM_ENTERIDLE:
  498.  
  499.                         // handle F1 key for dialog box help
  500.  
  501.                         if
  502.                         (
  503.                           ( wParam == MSGF_DIALOGBOX) &&
  504.                           ( GetKeyState( VK_F1) &0x8000 )
  505.                         )
  506.                           PostMessage( (HWND)lParam, WM_COMMAND,
  507.                             IDHELP, 0);
  508.                         return 0;
  509.  
  510.                 default:
  511.                         if (message == wm_DrawStatusLine)
  512.                         {
  513.                                 drawStatusLine(hWindow);
  514.                                 return 0;
  515.                         }
  516.                         else
  517.                                 return DefFrameProc(hWindow, WinApp::hWndClient,
  518.                                         message, wParam, lParam);
  519.         }
  520.         return rc;
  521. }
  522.  
  523. LRESULT CALLBACK _export WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
  524. {
  525.         TMDIChildWindow *window = (TMDIChildWindow *) GetWindowWord(hwnd, 0);
  526.  
  527.         switch(message)
  528.         {
  529.                 case WM_CREATE:
  530.                         if (WinApp::currentWindow != 0)
  531.                         {
  532.                                 SetWindowWord(hwnd, 0, (WORD) WinApp::currentWindow);
  533.                                 window = WinApp::currentWindow;
  534.                                 WinApp::currentWindow = NULL;
  535.                                 window->hWindow = hwnd;
  536.                                 window->create();
  537.                                 return 0;
  538.                         }
  539.                         break;
  540.                 case WM_PAINT:
  541.                         HDC hdc;
  542.                         PAINTSTRUCT ps;
  543.  
  544.                         hdc = BeginPaint(hwnd, &ps);
  545.                         window->paint(hdc, &ps);
  546.                         EndPaint(hwnd, &ps);
  547.                         return 0;
  548.                 case WM_LBUTTONDOWN:
  549.                         window->lButtonDown(wParam, lParam);
  550.                         return 0;
  551.  
  552.                 case WM_LBUTTONUP:
  553.                         window->lButtonUp(wParam, lParam);
  554.                         return 0;
  555.  
  556.                 case WM_MOUSEMOVE:
  557.                         window->mouseMove(wParam, lParam);
  558.                         return 0;
  559.                 case WM_RBUTTONDOWN:
  560.                         window->rButtonDown(lParam);
  561.                         return 0;
  562.                 case WM_SIZE:
  563.                         window->size(wParam, lParam);
  564.                         return 0;
  565.  
  566.                 case WM_SETFOCUS:
  567.                         window->setFocus();
  568.                         return 0;
  569.                 case WM_DESTROY:
  570.                         delete window;
  571.  
  572.         }
  573.         return DefMDIChildProc(hwnd, message, wParam, lParam);
  574. }
  575.  
  576.  
  577.