home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 5.ddi / RWCDEMO.ZIP / BITBNAPP.C next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  1.3 KB  |  67 lines

  1. // (C) Copyright 1991, 1992 by Borland International
  2.  
  3. #define STRICT
  4. #include <windows.h>
  5.  
  6. #pragma argsused        // intentionally not using all pararmeters, here.
  7. BOOL _export CALLBACK BitBnAppDialogProc( HWND hWnd, UINT message,
  8.                                                 WPARAM wParam, LPARAM lParam)
  9. {
  10.     switch (message)
  11.     {
  12.         case WM_COMMAND:
  13.           if ( HIWORD( lParam) == BN_CLICKED)
  14.             DestroyWindow( hWnd);
  15.           return TRUE;
  16.  
  17.         case WM_DESTROY:
  18.           PostQuitMessage( 0);
  19.           break;
  20.  
  21.         case WM_INITDIALOG:
  22.           return TRUE;
  23.  
  24.  
  25.     }
  26.     return FALSE;
  27.  
  28. }
  29.  
  30. #pragma argsused
  31. int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst, LPSTR lpCommand, int cmdShow)
  32. {
  33.     HWND    hMain;
  34.     MSG    msg;
  35.     HMODULE    hDll;
  36.  
  37.  
  38.     hDll = LoadLibrary( "BITBTN.DLL");
  39.     if ( (int) hDll < 32)
  40.     {
  41.         MessageBox( 0,
  42.           "You must compile BITBTN.DLL before running this program",
  43.           "Fatal error", MB_OK | MB_ICONHAND);
  44.         return 255;
  45.     }
  46.     hMain = CreateDialog( hInstance, MAKEINTRESOURCE( 100),
  47.          0, BitBnAppDialogProc);
  48.  
  49.     if ( hMain)
  50.     {
  51.            while (GetMessage(&msg, NULL, 0, 0))
  52.            {
  53.                TranslateMessage(&msg);
  54.                DispatchMessage(&msg);
  55.            }
  56.     }
  57.     else
  58.     {
  59.            MessageBox( 0, "Could not create window", "Fatal Error",
  60.          MB_OK | MB_ICONHAND);
  61.            return 254;
  62.     }
  63.     FreeLibrary( hDll);
  64.  
  65.     return msg.wParam;
  66. }
  67.