home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pc3270sa.zip / spl2file / spconfg.c next >
Text File  |  2002-02-28  |  7KB  |  146 lines

  1. //******************************************************************************
  2. //
  3. //  File name   : SPCONFG.C
  4. //
  5. //  Description : Configure Spl2File for the session
  6. //
  7. //  FUNCTIONS:
  8. //
  9. //  COMMENTS:
  10. //
  11. //  Copyright  (C) 1993, 1996 IBM Corporation
  12. //                        All rights reserved.
  13. //
  14. //******************************************************************************
  15.  
  16. #include <windows.h>                // required for all Windows applications
  17. #include <windowsx.h>               // Windows Macro APIs, window message crackers
  18. #include <string.h>                 // C string functions
  19. #include <stdio.h>                  // C functions
  20.  
  21. #include "spl2file.h"               // specific to this program
  22. #include "spdata.h"                 // Global Data
  23.  
  24. //******************************************************************************
  25. //
  26. //  ConfigureSpoolToFile - Configure Spl2File for this session
  27. //
  28. //  PURPOSE: to setup various Spl2File operating parameters
  29. //
  30. //  COMMENTS:
  31. //
  32. //******************************************************************************
  33. void ConfigureSpoolToFile( HWND hWnd )
  34. {
  35.   FARPROC lpProcModalDialog;                   //
  36.                                                //
  37.   lpProcModalDialog = MakeProcInstance(SpoolToFileOptionsDialog, hGlobalInst);
  38.   DialogBox(hGlobalInst, MAKEINTRESOURCE(SPOPTS), hWnd, lpProcModalDialog);
  39.                                                // Display option dialog box
  40.   FreeProcInstance(lpProcModalDialog);         //
  41. }
  42.  
  43. //******************************************************************************
  44. //
  45. //  FUNCTION: SpoolToFileOptionsDialog(HWND, unsigned, WORD, LONG)
  46. //
  47. //  PURPOSE:  Processes messages for CMS filename dialog box
  48. //
  49. //  MESSAGES:
  50. //
  51. //      WM_INITDIALOG - initialize dialog box
  52. //      WM_COMMAND    - Input received
  53. //
  54. //  COMMENTS:
  55. //
  56. //      No initialization is needed for this particular dialog box, but TRUE
  57. //      must be returned to Windows.
  58. //
  59. //      Wait for user to click on "Ok" button, then close the dialog box.
  60. //
  61. //******************************************************************************
  62. BOOL FAR PASCAL SpoolToFileOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  63. {                                              //
  64.   switch (message)                             //
  65.   {                                            //
  66.     case WM_INITDIALOG:                        // message: initialize dialog box
  67.     {                                          //
  68.       WORD uID;                                //
  69.                                                //
  70.       CheckDlgButton(hDlg, ID_CHECKBOX1, bVisible);
  71.                                                //
  72.       uID = ( bRemoveSoSi == TRUE ? ID_RADIO1 : ID_RADIO2 );
  73.       CheckRadioButton(hDlg, ID_RADIO1, ID_RADIO2, uID);
  74.                                                //
  75.       CenterDialogOnScreen( hDlg );            // Center it
  76.       GetWindowText(hDlg, zMsgBuffer, sizeof(zMsgBuffer));
  77.       lstrcat(zMsgBuffer, zSessionID);         //
  78.       SetWindowText(hDlg, zMsgBuffer);         //
  79.     }                                          //
  80.     return(TRUE);                              //
  81.     break;                                     //
  82.                                                //
  83.     case WM_COMMAND:                           // message: received a command
  84.       switch (GET_WM_COMMAND_ID(wParam,lParam))
  85.       {                                        //
  86.         case IDOK:                             //
  87.         {                                      //
  88.           uchar zTag[33];                      //
  89.                                                //
  90.           bRemoveSoSi = IsDlgButtonChecked(hDlg, ID_RADIO1);
  91.                                                //
  92.           bVisible    = IsDlgButtonChecked(hDlg, ID_CHECKBOX1);
  93.                                                //
  94.           if( bVisible )                       //
  95.           {                                    //
  96.             ShowWindow(hMainWnd, SW_MINIMIZE); // Show the window
  97.           }                                    //
  98.           else                                 //
  99.           {                                    //
  100.             ShowWindow(hMainWnd, SW_HIDE);     // Show the window HIDDEN
  101.           }                                    //
  102.  
  103.           LoadString(hGlobalInst, LS_OPTIONS_TAG, zTag, sizeof(zTag) );
  104.           lstrcat(zTag, zSessionID );          // Qualify the session
  105.                                                //
  106.           wsprintf(zMsgBuffer, "%d %d", bVisible, bRemoveSoSi);
  107.                                                //
  108.           WriteProfileString(zSpoolToFileClassPrefix,  // WIN.INI section name
  109.                              zTag,             // Value tag
  110.                              zMsgBuffer );     // Sending buffer
  111.                                                //
  112.           EndDialog(hDlg, TRUE);               // End the dialog
  113.         }                                      //
  114.         return(TRUE);                          //
  115.         break;                                 //
  116.  
  117.         case IDCANCEL:                         //
  118.         {                                      //
  119.           EndDialog(hDlg, FALSE);              // Exits the dialog box
  120.         }                                      //
  121.         return(TRUE);                          //
  122.         break;                                 //
  123.  
  124.         case ID_RADIO1:                        // yes button
  125.         {                                      //
  126.           CheckRadioButton(hDlg, ID_RADIO1, ID_RADIO2, ID_RADIO1);
  127.         }                                      //
  128.         return(TRUE);                          //
  129.         break;                                 //
  130.  
  131.         case ID_RADIO2:                        // no button
  132.         {                                      //
  133.           CheckRadioButton(hDlg, ID_RADIO1, ID_RADIO2, ID_RADIO2);
  134.         }                                      //
  135.         return(TRUE);                          //
  136.         break;                                 //
  137.  
  138.         default:                               //
  139.           break;                               //
  140.  
  141.       }                                        //
  142.       break;                                   //
  143.   }                                            //
  144.   return(FALSE);                               // Didn't process a message
  145. }                                              //
  146.