home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / win_lrn / graphics / gbmb.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-08-11  |  1.1 KB  |  41 lines

  1. /*
  2.  *
  3.  *  GetBitmapBits
  4.  *  gbmb.c
  5.  *  
  6.  *  This program demonstrates the use of the function GetBitmapBits.
  7.  *  This funtion copies the bits of the specified bitmap into the buffer
  8.  *  that is pointed to by the last parameter.  The middle parameter
  9.  *  specifies the number of bytes to be copied to the buffer.
  10.  *   
  11.  *  Other references: cffile.c
  12.  *  
  13.  */
  14.  
  15. #include "windows.h"
  16.  
  17. int PASCAL WinMain( hInstance, hPrevInstance, lpszCmdLine, cmdShow )
  18. HANDLE hInstance, hPrevInstance;
  19. LPSTR  lpszCmdLine;
  20. int    cmdShow;
  21. {
  22.   long dwCount;
  23.   HBITMAP hBitmap;
  24.   PBITMAP pBitmap;
  25.   int nBraemar[500];
  26.  
  27.   hBitmap = LoadBitmap(hInstance, "SCOTTIE");
  28.   pBitmap = (PBITMAP)LocalAlloc(LMEM_MOVEABLE, sizeof(BITMAP));
  29.   dwCount = GetObject(hBitmap, (long)sizeof(BITMAP), (LPSTR) pBitmap);
  30.  
  31.   MessageBox(NULL, "Get bitmap", "GetBitmapBits", MB_OK);
  32.  
  33.   if (GetBitmapBits(hBitmap, dwCount, (LPSTR) nBraemar))
  34.      MessageBox(NULL, "Bitmap copied", "GetBitmapBits", MB_OK);
  35.   else
  36.      MessageBox(NULL, "Bitmap did not copy", "GetBitmapBits", MB_OK);
  37.  
  38.  
  39.   return 0;
  40. }
  41.