home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c480 / 19.ddi / SAMPLES / DIBVIEW / DIBVIEW.C_ / DIBVIEW.C
Encoding:
C/C++ Source or Header  |  1993-02-08  |  2.6 KB  |  87 lines

  1. /*************************************************************************
  2.  
  3.       File:  DIBVIEW.C
  4.  
  5.    Purpose:  Contains WinMain/the main message loop.
  6.  
  7.  Functions:  WinMain
  8.  
  9.   Comments:
  10.  
  11.    History:   Date     Reason
  12.  
  13.              6/1/91    Created
  14.  
  15. *************************************************************************/
  16.  
  17. #include "master.h"
  18.  
  19.  
  20. HANDLE hInst         = NULL;                    // Handle to this instance
  21. HWND   hWndMDIClient;                           // MDI Client's window handle.
  22.  
  23.  
  24.  
  25.  
  26. //---------------------------------------------------------------------
  27. //
  28. // Function:   WinMain
  29. //
  30. // Purpose:    What Windows calls when our application is started up.
  31. //             Here, we do all necessary initialization, then enter
  32. //             our message loop.  The command line is also parsed,
  33. //             and if it lists any DIBs to open, they're opened up.
  34. //
  35. //             This is a pretty standard WinMain.
  36. //
  37. //             Since we're an MDI app, we call
  38. //             TranslateMDISysAccel (hWndMDIClient, &msg) during
  39. //             message loop processing.
  40. //
  41. // Parms:      hInstance     == Instance of this task.
  42. //             hPrevInstance == Instance of previous DIBView task (NULL if none).
  43. //             lpCmdLine     == Command line.
  44. //             nCmdShow      == How DIBView should come up (i.e. normally,
  45. //                              minimized, maximized, etc.
  46. //
  47. // History:   Date      Reason
  48. //             6/01/91  Created
  49. //
  50. //---------------------------------------------------------------------
  51.  
  52. int PASCAL WinMain(HANDLE hInstance,            // This instance
  53.                    HANDLE hPrevInstance,        // Last instance
  54.                    LPSTR  lpCmdLine,            // Command Line
  55.                    int    nCmdShow)             // Minimized or Normal?
  56. {
  57.    MSG msg;
  58.  
  59.    if (!hPrevInstance)
  60.       if (!InitMyDIB (hInstance))
  61.          return (FALSE);
  62.  
  63.    if (!InitInstance(hInstance, nCmdShow))
  64.       return (FALSE);
  65.  
  66.    // Parses Command line for DIB's
  67.    ParseCommandLine (lpCmdLine);
  68.  
  69.    while (GetMessage(&msg,             // Put Message Here
  70.                      NULL,             // Handle of win receiving msg
  71.                      NULL,             // lowest message to examine
  72.                      NULL))            // highest message to examine
  73.    {
  74.    if (!TranslateMDISysAccel (hWndMDIClient, &msg))
  75.       {
  76.       TranslateMessage(&msg);          // Translates virtual key codes
  77.       DispatchMessage(&msg);           // Dispatches message to window
  78.       }
  79.    }
  80.  
  81.    return (msg.wParam);                // Returns the value from PostQuitMessage
  82. }
  83.  
  84.  
  85.  
  86.  
  87.