home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a039 / 3.ddi / WINSAMP.ZIP / WINMAIN.C < prev   
Encoding:
C/C++ Source or Header  |  1991-03-11  |  2.9 KB  |  94 lines

  1. /*       Copyright (c) 1990 by Borland International, Inc.        */
  2.  
  3. /*
  4.  * WFONEDEX.C
  5.  * Electronic file card application - Windows version
  6.  *
  7.  * Description:
  8.  *   Allows simple database design and access of an electronic file card
  9.  *   database.    Records can be added, deleted, updated and searched
  10.  *   in a multiuser environment.
  11.  *
  12.  * Compilation:
  13.  *   To compile and link the example program:
  14.  *     With Turbo C (and Borland make):
  15.  *      make -fbcmake
  16.  *      (uses the file BCMAKE).
  17.  *     With MS C (and MS make):
  18.  *      make mscmake or nmk mscmake
  19.  *      (uses the file MSCMAKE).
  20.  *
  21.  * Execution:
  22.  *   This example program will run in Windows.  Choose
  23.  *     wfonedex.exe
  24.  *   in the file manager.
  25.  *   (In addition, from the File menu in the program manager, you can either
  26.  *   run the program or add as an item).
  27.  *   You can then choose different options from a dialog box.
  28.  */
  29.  
  30. #include "wfonedex.h"
  31.  
  32. extern char szAppName[] = "Fonedex";    /* Application name */
  33. extern HANDLE hInst = 0;                /* Handle to current instance of application */
  34.  
  35. extern HWND hDlgModeless = 0;           /* Handle to modeless dialog box */
  36.  
  37. /******************************************************************************
  38.  
  39.     Function:
  40.  
  41.         int PASCAL WinMain( HANDLE hInstance, HANDLE hPrevInstance,
  42.                             LPSTR lpszCmdLine, int nCmdShow );
  43.  
  44.     Arguments:
  45.         hInstance       HANDLE to current instance
  46.         hPrevInstance   HANDLE to previous instance of program
  47.         lpCmdLine       LPSTR command line
  48.         nCmdShow        int which is show-window type
  49.  
  50.     Description:
  51.         Creates modeless dialog box and processes message loop.
  52.  
  53.     Returns:
  54.  
  55. ******************************************************************************/
  56. #ifdef __BORLANDC__
  57. #pragma argsused       /* This pragma is used for Borland C++ */
  58. #endif
  59. int PASCAL WinMain( HANDLE hInstance, HANDLE hPrevInstance, LPSTR lpszCmdLine,
  60.                     int nCmdShow )
  61. {
  62.     HMENU hMenu;
  63.     MSG msg;
  64.  
  65.     if ( hPrevInstance )
  66.     {
  67.         MessageBox( NULL, "Fonedex is already running.", "Windows Fonedex",
  68.                     MB_OK | MB_ICONINFORMATION );
  69.         return 1;
  70.     }
  71.  
  72.     hInst = hInstance;
  73.  
  74.     /* Create modeless dialog box. */
  75.     hDlgModeless = CreateDialog( hInstance, szAppName, NULL,
  76.                                  MakeProcInstance( FonedexDlgProc, hInstance) );
  77.  
  78.     /* Add Help item to system menu. */
  79.     hMenu = GetSystemMenu( hDlgModeless, FALSE );
  80.     AppendMenu( hMenu, MF_SEPARATOR, 0, NULL );
  81.     AppendMenu( hMenu, MF_BYCOMMAND | MF_STRING, IDM_ABOUT, "&About..." );
  82.  
  83.     while ( GetMessage( &msg, NULL, 0, 0 ) )
  84.     {
  85.         if ( hDlgModeless == 0 ||
  86.              !IsDialogMessage( hDlgModeless, &msg ) )
  87.         {
  88.             TranslateMessage( &msg );
  89.             DispatchMessage( &msg );
  90.         }
  91.     }
  92.     return ( msg.wParam );
  93. }
  94.