home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / wksinst / rwcdemo.pak / BITBNAPP.C next >
C/C++ Source or Header  |  1991-09-09  |  1KB  |  61 lines

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