home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 8 / 08.iso / d / d022 / 1.ddi / SAMPLES / CHILDWIN / USERCODE.C < prev   
Encoding:
C/C++ Source or Header  |  1990-06-26  |  5.5 KB  |  205 lines

  1. /*Filename: USERSRC.C                                       */
  2. /*"CHILDWIN" Generated by WindowsMAKER                      */
  3. /*Author: Bill G.                                           */
  4.  
  5. /* Everything generated by WindowsMAKER except these 2 lines */
  6. /* of comments and 2 lines in the BLD_WM_CREATEMsg function. */
  7.  
  8. #include <WINDOWS.H>
  9. #include "CHILDWIN.H"
  10.  
  11.  
  12. HWND BLD_Child1DlgFunc(hWnd,message,wParam,lParam) /* Startup procedure for modeless dialog box */
  13. HWND hWnd;
  14. unsigned message;
  15. WORD wParam;     
  16. LONG lParam;     
  17.     {
  18.  
  19.     message; /* Type of message. */
  20.     wParam;  /* 16 bits of message specific information. */
  21.     lParam;  /* 32 bits of message specific information. */
  22.  
  23.     if(Child1hDlg)
  24.         {
  25.         SetFocus(Child1hDlg);
  26.         return Child1hDlg;
  27.         }
  28.     Child1lpProc = MakeProcInstance(BLD_Child1DlgProc,hInst);
  29.     Child1hDlg = CreateDialog(hInst, (LPSTR)"CHILDWINDOW1", hWnd, Child1lpProc);
  30.     if (Child1hDlg==0)
  31.         MessageBox(hWnd,"CHILDWINDOW1"," Cannot Create Dialog Box",
  32.                    MB_OK | MB_SYSTEMMODAL);
  33.     else
  34.         ShowWindow(Child1hDlg,SW_SHOW);
  35.     return Child1hDlg;
  36.     }
  37.  
  38. BOOL FAR PASCAL BLD_Child1DlgProc(hDlg, iMessage, wParam, lParam) /* Modeless dialog box procedure */
  39. HWND hDlg;
  40. unsigned iMessage;
  41. WORD wParam;
  42. LONG lParam;
  43.     {
  44.     lParam;  /* 32 bits of message specific information. */
  45.     switch(iMessage)
  46.         {
  47.         case WM_INITDIALOG:
  48.             break;
  49.         case WM_NCDESTROY:
  50.             FreeProcInstance(Child1lpProc);
  51.             Child1hDlg = 0;
  52.             break;
  53.  
  54.         case WM_COMMAND:
  55.             switch(wParam)
  56.                 {
  57.             case IDOK:
  58.                  DestroyWindow(hDlg);
  59.                  break;
  60.             case IDCANCEL:
  61.                  DestroyWindow(hDlg);
  62.                  break;
  63.                 }
  64.             break;
  65.  
  66.     default:
  67.          return FALSE; /* Didn't process the message */
  68.          break;
  69.         }
  70.     return TRUE;
  71.     }
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78. HWND BLD_Child2DlgFunc(hWnd,message,wParam,lParam) /* Startup procedure for modeless dialog box */
  79. HWND hWnd;
  80. unsigned message;
  81. WORD wParam;     
  82. LONG lParam;     
  83.     {
  84.  
  85.     message; /* Type of message. */
  86.     wParam;  /* 16 bits of message specific information. */
  87.     lParam;  /* 32 bits of message specific information. */
  88.  
  89.     if(Child2hDlg)
  90.         {
  91.         SetFocus(Child2hDlg);
  92.         return Child2hDlg;
  93.         }
  94.     Child2lpProc = MakeProcInstance(BLD_Child2DlgProc,hInst);
  95.     Child2hDlg = CreateDialog(hInst, (LPSTR)"CHILDWINDOW2", hWnd, Child2lpProc);
  96.     if (Child2hDlg==0)
  97.         MessageBox(hWnd,"CHILDWINDOW2"," Cannot Create Dialog Box",
  98.                    MB_OK | MB_SYSTEMMODAL);
  99.     else
  100.         ShowWindow(Child2hDlg,SW_SHOW);
  101.     return Child2hDlg;
  102.     }
  103.  
  104. BOOL FAR PASCAL BLD_Child2DlgProc(hDlg, iMessage, wParam, lParam) /* Modeless dialog box procedure */
  105. HWND hDlg;
  106. unsigned iMessage;
  107. WORD wParam;
  108. LONG lParam;
  109.     {
  110.     lParam;  /* 32 bits of message specific information. */
  111.     switch(iMessage)
  112.         {
  113.         case WM_INITDIALOG:
  114.             break;
  115.         case WM_NCDESTROY:
  116.             FreeProcInstance(Child2lpProc);
  117.             Child2hDlg = 0;
  118.             break;
  119.  
  120.         case WM_COMMAND:
  121.             switch(wParam)
  122.                 {
  123.             case IDOK:
  124.                  DestroyWindow(hDlg);
  125.                  break;
  126.             case IDCANCEL:
  127.                  DestroyWindow(hDlg);
  128.                  break;
  129.                 }
  130.             break;
  131.  
  132.     default:
  133.          return FALSE; /* Didn't process the message */
  134.          break;
  135.         }
  136.     return TRUE;
  137.     }
  138.  
  139.  
  140.  
  141. long BLD_WM_CREATEMsg(hWnd,message,wParam,lParam) /* Procedure for message processing */
  142. HWND hWnd;
  143. unsigned message;
  144. WORD wParam;     
  145. LONG lParam;     
  146.     {
  147.     BLD_Child1DlgFunc(hWnd,message,wParam,lParam); /* This line added manually */
  148.     BLD_Child2DlgFunc(hWnd,message,wParam,lParam); /* This line added manually */
  149.     return DefWindowProc(hWnd, message, wParam, lParam);
  150.     } 
  151.  
  152. int BLD_AboutDlgFunc(hWnd,message,wParam,lParam) /* Startup procedure for modal dialog box */
  153. HWND hWnd;       
  154. unsigned message;
  155. WORD wParam;     
  156. LONG lParam;     
  157.     {
  158.     FARPROC lpProc;
  159.     int ReturnValue;
  160.  
  161.     message; /* Type of message. */
  162.     wParam;  /* 16 bits of message specific information. */
  163.     lParam;  /* 32 bits of message specific information. */
  164.  
  165.     lpProc = MakeProcInstance(BLD_AboutDlgProc,hInst);
  166.     ReturnValue = DialogBox(hInst, (LPSTR)"ABOUTCHILDWIN", hWnd, lpProc);
  167.     FreeProcInstance(lpProc);
  168.     if (ReturnValue==-1)
  169.         MessageBox(hWnd,"ABOUTCHILDWIN"," Cannot Create Dialog Box",
  170.                    MB_OK | MB_SYSTEMMODAL);
  171.     return ReturnValue;
  172.     }
  173.  
  174. BOOL FAR PASCAL BLD_AboutDlgProc(hDlg, iMessage, wParam, lParam) /* Modal dialog box procedure */
  175. HWND hDlg;
  176. unsigned iMessage;
  177. WORD wParam;
  178. LONG lParam;
  179.     {
  180.     lParam;  /* 32 bits of message specific information. */
  181.     switch(iMessage)
  182.         {
  183.         case WM_INITDIALOG:
  184.             break;
  185.  
  186.         case WM_COMMAND:
  187.             switch(wParam)
  188.                 {
  189.             case IDOK:
  190.                  EndDialog(hDlg, IDOK);
  191.                  break;
  192.             case IDCANCEL:
  193.                  EndDialog(hDlg, IDCANCEL);
  194.                  break;
  195.                 }
  196.             break;
  197.  
  198.     default:
  199.          return FALSE; /* Didn't process the message */
  200.          break;
  201.         }
  202.     return TRUE;
  203.     }
  204.  
  205.