home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / msj / msjv4_4 / select / libmain.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-10-21  |  1.6 KB  |  59 lines

  1. #include <windows.h>
  2.  
  3. HANDLE hInstLib;
  4. HANDLE hBitmap;
  5. #define XBITMAP    16
  6. #define YBITMAP    16
  7.  
  8. static BYTE byBits[] = {
  9. 0xFE, 0xFF, 0xFE, 0x7F, 0xF8, 0x3F, 0xE6, 0x7F,
  10. 0xDE, 0xF7, 0xBF, 0xFB, 0x7F, 0xFD, 0x7F, 0xFD,
  11. 0x7F, 0xFD, 0x7F, 0xFD, 0xBF, 0xFB, 0xDE, 0xF7,
  12. 0xFC, 0xCF, 0xF8, 0x3F, 0xFC, 0xFF, 0xFE, 0xFF
  13. };
  14.  
  15. /* some prototypes */
  16. BOOL NEAR RegisterSelect (HANDLE hInstance);
  17. long FAR PASCAL SelectWndProc( HWND hWnd, unsigned message,
  18.     WORD wParam, LONG lParam);
  19.  
  20. /*
  21. this function is called from the assembler
  22. initialization in libentry.asm
  23. */
  24. int FAR PASCAL LibMain(HANDLE hInstance, WORD wDataSeg, WORD wHeapSize,
  25.     LPSTR lpCmdLine)
  26. {
  27.     int iret;
  28.     if (wHeapSize == 0) return(0);
  29.     iret = LocalInit(wDataSeg, NULL, (NPSTR)wHeapSize);
  30.     UnlockData(0);
  31.     RegisterSelect ( hInstLib = hInstance );
  32.     return iret;
  33. }
  34.  
  35. /*
  36. this is called by LibMain to register the class
  37. and initialize the bitmap
  38. */
  39. static BOOL NEAR RegisterSelect (HANDLE hInstance)
  40. {
  41.     WNDCLASS wndclass;
  42.  
  43.     wndclass.style         = CS_HREDRAW | CS_VREDRAW;
  44.     wndclass.lpfnWndProc   = SelectWndProc;
  45.     wndclass.cbClsExtra    = 0;
  46.     wndclass.cbWndExtra    = 2*sizeof(WORD);       /* space for control info */
  47.     wndclass.hIcon         = NULL;
  48.     wndclass.hInstance     = hInstance;
  49.     wndclass.hCursor       = LoadCursor(NULL, IDC_ARROW);
  50.     wndclass.hbrBackground = COLOR_WINDOW+1;
  51.     wndclass.lpszMenuName  = NULL;
  52.     wndclass.lpszClassName = "select";
  53.  
  54.     hBitmap = CreateBitmap ( XBITMAP, YBITMAP, 1, 1, byBits );
  55.     return RegisterClass(&wndclass);
  56. }
  57.  
  58.  
  59.