home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / c / cuj9301.zip / 1101036B < prev    next >
Text File  |  1992-11-03  |  1KB  |  53 lines

  1. /* LISTING 2: C functions to encapsulate the MS Windows
  2.    WNDCLASS.
  3. */
  4. #include "windows.h"
  5.  
  6. typedef int         BOOL;
  7. typedef WNDCLASS    MYWCLASS;
  8. typedef WNDPROC     MYWNDPROC;
  9. typedef HINSTANCE   MYHINSTANCE;
  10. typedef HCURSOR     MYHCURSOR;
  11. typedef HBRUSH      MYHBRUSH;
  12.  
  13. void WCL_Init (MYWCLASS *wndclass, char *szAppName,
  14.         MYWNDPROC WndProc, MYHINSTANCE hInstance,
  15.         char *szMenuName)
  16. {
  17.     wndclass->style = CS_HREDRAW | CS_VREDRAW;
  18.     wndclass->lpfnWndProc = WndProc;
  19.     wndclass->cbClsExtra = 0;
  20.     wndclass->cbWndExtra = 0;
  21.     wndclass->hInstance = hInstance;
  22.     wndclass->hIcon = LoadIcon (NULL, IDI_APPLICATION);
  23.     wndclass->hCursor = LoadCursor (NULL, IDC_ARROW);
  24.     wndclass->hbrBackground =
  25.                 GetStockObject (WHITE_BRUSH);
  26.     wndclass->lpszMenuName = szMenuName;
  27.     wndclass->lpszClassName = szAppName;
  28. }
  29.  
  30. void WCL_SetCursor (MYWCLASS *wndclass,
  31.         MYHCURSOR hCursor)
  32. {
  33.     wndclass->hCursor = hCursor;
  34. }
  35.  
  36. void WCL_SetBackground (MYWCLASS *wndclass,
  37.         MYHBRUSH hbrBackground)
  38. {
  39.     wndclass->hbrBackground = hbrBackground;
  40. }
  41.  
  42. void WCL_SetMenu (MYWCLASS *wndclass, char *szMenuName)
  43. {
  44.     wndclass->lpszMenuName = szMenuName;
  45. }
  46.  
  47. BOOL WCL_RegisterClass (MYWCLASS *wndclass)
  48. {
  49.     return (RegisterClass (wndclass));
  50. }
  51.  
  52.  
  53.