home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / devtools / xpg4 / demo / world / xpg4.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-28  |  41.3 KB  |  1,619 lines

  1. #define INCL_WIN
  2. #include <os2.h>
  3. #include <stdlib.h>
  4. #include <stdio.h>
  5. #include <string.h>
  6. #include <time.h>
  7. #include <wchar.h>
  8. #include <locale.h>
  9. #include "xpg4.h"
  10.  
  11. #define CLS_CLIENT               "MyClass"
  12. #define width        6
  13. #define num_elements 6
  14. #define len_array (num_elements * width)
  15.  
  16. char   Bucks[255];
  17. double num = 1000.00;  
  18. time_t ltime;
  19. struct tm *ptmT = NULL;
  20.  
  21. UCHAR       locale_temp[200] = "\\xpg4\\locale";  
  22. UCHAR       En_temp[200];  
  23. UCHAR       Es_temp[200];
  24. UCHAR       De_temp[200];
  25. UCHAR       Sv_temp[200];
  26. UCHAR       Fr_temp[200];
  27. UCHAR       Ja_temp[200];
  28.  
  29. int  NoPaint_En  = 0;
  30. int  NoPaint_Es  = 0;
  31. int  NoPaint_De  = 0;
  32. int  NoPaint_Sv  = 0;
  33. int  NoPaint_Fr  = 0;
  34. int  NoPaint_Ja  = 0;
  35.  
  36. HWND hwndUSA;
  37. HWND hwndSPAIN;
  38. HWND hwndFRANCE;
  39. HWND hwndGERMANY;
  40. HWND hwndJAPAN;
  41. HWND hwndSWEDEN;
  42. HWND hwnd;
  43. HWND hwndFrame;
  44. HWND hwndClient;
  45.  
  46. VOID displayMenuInfo ( HWND hwndMenu,
  47.                        USHORT usMenuItem,
  48.                        HWND hwndClient ) ;
  49. MRESULT EXPENTRY ClientWndProc ( HWND hwndWnd,
  50.                                  ULONG ulMsg,
  51.                                  MPARAM mpParm1,
  52.                                  MPARAM mpParm2 ) ;
  53. VOID displayInfo ( HWND hwndMenu,
  54.                    USHORT usMenuItem,
  55.                    HWND hwndClient );
  56. MRESULT EXPENTRY dialog_func (HWND handle, ULONG mess, MPARAM parm1, MPARAM parm2);
  57. MRESULT EXPENTRY info_dialog_func (HWND handle, ULONG mess, MPARAM parm1, MPARAM parm2);
  58. MRESULT EXPENTRY USAProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
  59. MRESULT EXPENTRY SPAINProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
  60. MRESULT EXPENTRY FRANCEProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
  61. MRESULT EXPENTRY GERMANYProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
  62. MRESULT EXPENTRY JAPANProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
  63. MRESULT EXPENTRY SWEDENProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. INT main ( VOID )
  71. {
  72.    HAB            habAnchor ;
  73.    HMQ            hmqQueue ;
  74.    ULONG          ulFlags ;
  75.    BOOL           bLoop ;
  76.    QMSG           qmMsg ;
  77.  
  78.    habAnchor = WinInitialize ( 0 ) ;
  79.    hmqQueue = WinCreateMsgQueue ( habAnchor, 0 ) ;
  80.  
  81.    WinRegisterClass ( habAnchor,
  82.                       CLS_CLIENT,
  83.                       ClientWndProc,
  84.                       CS_SIZEREDRAW,
  85.                       0 ) ;
  86.  
  87.    ulFlags = FCF_STANDARD & ~FCF_SHELLPOSITION ;
  88.  
  89.    hwndFrame = WinCreateStdWindow ( HWND_DESKTOP,
  90.                                     0,
  91.                                     &ulFlags,
  92.                                     CLS_CLIENT,
  93.                                     "XPG4 DEMO",
  94.                                     0,
  95.                                     NULLHANDLE,
  96.                                     RES_CLIENT,
  97.                                     &hwndClient ) ;
  98.  
  99.    if ( hwndFrame != NULLHANDLE ) {
  100.  
  101.       WinSetWindowPos ( hwndFrame,
  102.                         NULLHANDLE,
  103.                         50,
  104.                         50,
  105.                         557,
  106.                         395,
  107.                         SWP_SIZE |
  108.                         SWP_MOVE |
  109.                         SWP_ACTIVATE |
  110.                         SWP_SHOW ) ;
  111.  
  112.       bLoop = WinGetMsg ( habAnchor,
  113.                           &qmMsg,
  114.                           NULLHANDLE,
  115.                           0,
  116.                           0 ) ;
  117.       while ( bLoop ) {
  118.          WinDispatchMsg ( habAnchor, &qmMsg ) ;
  119.          bLoop = WinGetMsg ( habAnchor,
  120.                              &qmMsg,
  121.                              NULLHANDLE,
  122.                              0,
  123.                              0 ) ;
  124.       } /* endwhile */
  125.  
  126.       WinDestroyWindow ( hwndFrame ) ;
  127.    } /* endif */
  128.  
  129.    WinDestroyMsgQueue ( hmqQueue ) ;
  130.    WinTerminate ( habAnchor ) ;
  131.    return 0 ;
  132. }
  133.  
  134. MRESULT EXPENTRY ClientWndProc ( HWND hwndWnd,
  135.                  ULONG ulMsg,
  136.                  MPARAM mpParm1,
  137.                     MPARAM mpParm2 )
  138. {
  139. switch ( ulMsg ) {
  140.  
  141.    case WM_CREATE:
  142.       {
  143.          HPS          hpsWnd ;
  144.          HBITMAP      hbmBitmap ;
  145.          MENUITEM     miItem ;
  146.          HWND         hwndMenu ;
  147.  
  148.          hpsWnd = WinGetPS ( hwndWnd ) ;
  149.          hbmBitmap = GpiLoadBitmap ( hpsWnd,
  150.                                      NULLHANDLE,
  151.                                      IDB_BITMAP,
  152.                                      500,
  153.                                      350 ) ;
  154.          WinReleasePS ( hpsWnd ) ;
  155.  
  156.          miItem.iPosition = 0 ;
  157.          miItem.afStyle = MIS_BITMAP ;
  158.          miItem.afAttribute = 0 ;
  159.          miItem.id = IDM_BITMAP ;
  160.          miItem.hwndSubMenu = NULLHANDLE ;
  161.          miItem.hItem = hbmBitmap ;
  162.  
  163.          hwndMenu = WinWindowFromID ( WinQueryWindow ( hwndWnd,
  164.                                       QW_PARENT ) ,
  165.                                       FID_MENU ) ;
  166.          WinSendMsg ( hwndMenu,
  167.                       MM_SETITEM,
  168.                       MPFROM2SHORT ( 0, TRUE ) ,
  169.                       MPFROMP ( &miItem )) ;
  170.  
  171.       }
  172.  
  173.       break ;
  174.    case WM_ERASEBACKGROUND:
  175.       return MRFROMSHORT ( TRUE ) ;
  176.    case WM_PAINT:
  177.       {
  178.          HPS          hpsWnd ;
  179.          HBITMAP      hbmBitmap ;
  180.          HWND         hwndMenu ;
  181.          POINTL       ptl;
  182.  
  183.          ptl.x = 0;
  184.          ptl.y = 0;   
  185.  
  186.          hpsWnd = WinBeginPaint( hwndWnd, 0L, 0L );
  187.          GpiErase( hpsWnd );
  188.  
  189.          hbmBitmap = GpiLoadBitmap ( hpsWnd,
  190.                                      NULLHANDLE,
  191.                                      IDB_BITMAP,
  192.                                      557,
  193.                                      353 ) ;
  194.  
  195.          WinDrawBitmap( hpsWnd, hbmBitmap, NULL, &ptl, CLR_NEUTRAL, 
  196.                         CLR_BACKGROUND, DBM_NORMAL);
  197.  
  198.          GpiDeleteBitmap( hbmBitmap );
  199.  
  200.          WinEndPaint( hpsWnd );
  201.        }
  202.       break ;
  203.  
  204.    case WM_BUTTON1DOWN:
  205.    case WM_BUTTON1DBLCLK:
  206.       {
  207.         CHAR szMsg[100];
  208.    
  209.         SHORT x, y;
  210.  
  211.         szMsg[0]= 0x00;
  212.  
  213.         x = MOUSEMSG(&ulMsg) -> x;
  214.         y = MOUSEMSG(&ulMsg) -> y;        
  215.  
  216.         if( ((x > 108) && (x < 119)) && ((y > 227) && (y < 239)) )
  217.          {
  218.          sprintf(szMsg,"Austin");
  219.          if ( NoPaint_En <= 0 )
  220.          {
  221.          strcpy(En_temp,locale_temp);
  222.          strcat(En_temp,"\\En_US.DLL");
  223.  
  224.          if ( access(En_temp,0) == -1 )
  225.            WinMessageBox ( HWND_DESKTOP,
  226.                            hwndClient,
  227.                            "The locale path specified is invalid.  Please use the Configure Menu to enter the correct locale path.",
  228.                            "Locale Path Error",
  229.                            0,
  230.                            MB_NOICON | MB_OK ) ;
  231.          else
  232.          hwndUSA = WinLoadDlg(hwndClient,hwndWnd,
  233.                                 USAProc,0L,IDDIALOG_USA,NULL);
  234.          }
  235.          }
  236.         if( ((x > 253) && (x < 264)) && ((y > 246) && (y < 259)) )
  237.          {
  238.          sprintf(szMsg,"Madrid");
  239.          if ( NoPaint_Es <= 0 )
  240.          {
  241.          strcpy(Es_temp,locale_temp);
  242.          strcat(Es_temp,"\\Es_ES.DLL");
  243.  
  244.          if ( access(Es_temp,0) == -1 )
  245.            WinMessageBox ( HWND_DESKTOP,
  246.                            hwndClient,
  247.                            "The locale path specified is invalid.  Please use the Configure Menu to enter the correct locale path.",
  248.                            "Locale Path Error",
  249.                            0,
  250.                            MB_NOICON | MB_OK ) ;
  251.          else
  252.            hwndSPAIN = WinLoadDlg(hwndClient,hwndWnd,
  253.                                 SPAINProc,0L,IDDIALOG_SPAIN,NULL);
  254.          }
  255.          }
  256.         if( ((x > 262) && (x < 275)) && ((y > 262) && (y < 275)) )
  257.          {
  258.          sprintf(szMsg,"Paris");
  259.          if ( NoPaint_Fr <= 0 )
  260.          {
  261.          strcpy(Fr_temp,locale_temp);
  262.          strcat(Fr_temp,"\\Fr_FR.DLL");
  263.  
  264.          if ( access(Fr_temp,0) == -1 )
  265.            WinMessageBox ( HWND_DESKTOP,
  266.                            hwndClient,
  267.                            "The locale path specified is invalid.  Please use the Configure Menu to enter the correct locale path.",
  268.                            "Locale Path Error",
  269.                            0,
  270.                            MB_NOICON | MB_OK ) ;
  271.          else
  272.          hwndFRANCE = WinLoadDlg(hwndClient,hwndWnd,
  273.                                 FRANCEProc,0L,IDDIALOG_FRANCE,NULL);
  274.          }
  275.          }
  276.         if( ((x > 280) && (x < 290)) && ((y > 271) && (y < 282)) )
  277.          {
  278.          sprintf(szMsg,"Berlin");
  279.          if ( NoPaint_De <= 0 )
  280.          {
  281.          strcpy(De_temp,locale_temp);
  282.          strcat(De_temp,"\\De_DE.DLL");
  283.  
  284.          if ( access(De_temp,0) == -1 )
  285.            WinMessageBox ( HWND_DESKTOP,
  286.                            hwndClient,
  287.                            "The locale path specified is invalid.  Please use the Configure Menu to enter the correct locale path.",
  288.                            "Locale Path Error",
  289.                            0,
  290.                            MB_NOICON | MB_OK ) ;
  291.          else
  292.          hwndGERMANY = WinLoadDlg(hwndClient,hwndWnd,
  293.                                 GERMANYProc,0L,IDDIALOG_GERMANY,NULL);
  294.          }
  295.          }
  296.         if( ((x > 287) && (x < 298)) && ((y > 284) && (y < 295)) )
  297.          {
  298.          sprintf(szMsg,"Stockholm");
  299.          if ( NoPaint_Sv <= 0 )
  300.          {
  301.          strcpy(Sv_temp,locale_temp);
  302.          strcat(Sv_temp,"\\Sv_SE.DLL");
  303.  
  304.          if ( access(Sv_temp,0) == -1 )
  305.            WinMessageBox ( HWND_DESKTOP,
  306.                            hwndClient,
  307.                            "The locale path specified is invalid.  Please use the Configure Menu to enter the correct locale path.",
  308.                            "Locale Path Error",
  309.                            0,
  310.                            MB_NOICON | MB_OK ) ;
  311.          else
  312.          hwndSWEDEN = WinLoadDlg(hwndClient,hwndWnd,
  313.                                 SWEDENProc,0L,IDDIALOG_SWEDEN,NULL);
  314.          }
  315.          }
  316.         if( ((x > 475) && (x < 485)) && ((y > 235) && (y < 249)) )
  317.          {
  318.          sprintf(szMsg,"Tokyo");
  319.          if ( NoPaint_Ja <= 0 )
  320.          {
  321.          strcpy(Ja_temp,locale_temp);
  322.          strcat(Ja_temp,"\\Ja_JP.DLL");
  323.  
  324.          if ( access(Ja_temp,0) == -1 )
  325.            WinMessageBox ( HWND_DESKTOP,
  326.                            hwndClient,
  327.                            "The locale path specified is invalid.  Please use the Configure Menu to enter the correct locale path.",
  328.                            "Locale Path Error",
  329.                            0,
  330.                            MB_NOICON | MB_OK ) ;
  331.          else
  332.          hwndJAPAN = WinLoadDlg(hwndClient,hwndWnd,
  333.                                 JAPANProc,0L,IDDIALOG_JAPAN,NULL);
  334.          }
  335.          }
  336.         if( szMsg[0] == 0x00)
  337.           {
  338.           sprintf(szMsg,"Please select a city.");
  339.  
  340.           WinMessageBox(HWND_DESKTOP,
  341.               hwndWnd,                 
  342.               szMsg,                     
  343.               "Location",   
  344.               0,                         
  345.               MB_NOICON | MB_OK);        
  346.           }
  347.       }
  348.       break ;
  349.  
  350.    case WM_COMMAND:
  351.  
  352.       switch ( SHORT1FROMMP ( mpParm1 ))
  353.       {
  354.       case IDM_LOCALE:
  355.          WinDlgBox(HWND_DESKTOP, hwndWnd, dialog_func, 0, D_TITLE, 0); 
  356.          break ;
  357.  
  358.       case IDM_HELP1:
  359.          {
  360.             HWND    hwndFrame ;
  361.             HWND    hwndMenu ;
  362.  
  363.             hwndFrame = WinQueryWindow ( hwndWnd, QW_PARENT ) ;
  364.             hwndMenu = WinWindowFromID ( hwndFrame, FID_MENU ) ;
  365.             displayInfo ( hwndMenu,
  366.                           SHORT1FROMMP ( mpParm1 ) ,
  367.                           hwndWnd ) ;
  368.          }
  369.          break ;
  370.  
  371.       case IDM_INFO1:
  372.          WinDlgBox(HWND_DESKTOP, hwndWnd, info_dialog_func, 0, TEST, 0); 
  373.          break ;
  374.       case IDM_MONEY:
  375.          WinQueryDlgItemText(hwnd, IDENTRY_MON, sizeof(Bucks),(PSZ)Bucks);
  376.          num = atof(Bucks);
  377.          break;
  378.       default:
  379.          return WinDefWindowProc ( hwndWnd,
  380.                                    ulMsg,
  381.                                    mpParm1,
  382.                                    mpParm2 ) ;
  383.       } /* endswitch */
  384.       break ;
  385.    default:
  386.       return WinDefWindowProc ( hwndWnd,
  387.                                 ulMsg,
  388.                                 mpParm1,
  389.                                 mpParm2 ) ;
  390.    } /* endswitch */
  391.  
  392.    return MRFROMSHORT ( FALSE ) ;
  393. }
  394.  
  395. VOID displayInfo ( HWND hwndMenu,
  396.                        USHORT usMenuItem,
  397.                        HWND hwndClient )
  398. {
  399.    CHAR        achText [2048] ;
  400.  
  401.    sprintf ( achText,"To load a country's locale use the mouse to select a city." );
  402.  
  403.    WinMessageBox ( HWND_DESKTOP,
  404.                    hwndClient,
  405.                    achText,
  406.                    "Running The Demo",
  407.                    0,
  408.                    MB_NOICON | MB_OK ) ;
  409.  
  410.    return ;
  411. }
  412.  
  413.  
  414. MRESULT EXPENTRY dialog_func (HWND handle, ULONG mess, MPARAM parm1, MPARAM parm2)
  415. {
  416.   static HWND      hwnd;
  417.  
  418.   
  419.   switch(mess)
  420.   {
  421.       case WM_INITDLG:
  422.  
  423.                WinEnableWindowUpdate(handle,FALSE);
  424.                WinSetDlgItemText(handle,L_PATH,locale_temp);
  425.                return(MRESULT)TRUE;
  426.  
  427.       case WM_CONTROL:
  428.  
  429.                return(MRESULT)TRUE;
  430.  
  431.  
  432.       case WM_COMMAND:
  433.  
  434.           switch ( SHORT1FROMMP ( parm1 )) {
  435.  
  436.              case OK_BUTTON:
  437.  
  438.                WinQueryDlgItemText(handle, L_PATH, sizeof(locale_temp),  (PSZ)locale_temp);
  439.                WinDismissDlg ( handle, FALSE ) ;
  440.                return WinDefDlgProc(handle, mess, parm1, parm2);
  441.  
  442.           default:
  443.                return WinDefDlgProc (handle, mess, parm1, parm2);
  444.  
  445.       } /* endswitch */
  446.       break ;
  447.  
  448.       default:
  449.                return WinDefDlgProc(handle, mess, parm1, parm2);
  450.   }
  451.  
  452.   return(MRESULT)0;
  453. }
  454.  
  455. MRESULT EXPENTRY info_dialog_func (HWND handle, ULONG mess, MPARAM parm1, MPARAM parm2)
  456. {
  457.   static HWND      hwnd;
  458.  
  459.    switch(mess)
  460.   {
  461.       case WM_INITDLG:
  462.  
  463.           hwnd = WinWindowFromID(handle,(ULONG)TEST);
  464.           WinEnableWindowUpdate(hwnd,FALSE);
  465.           return(MRESULT)TRUE;
  466.  
  467.  
  468.       case WM_CONTROL:
  469.  
  470.           return(MRESULT)TRUE;
  471.  
  472.       case WM_COMMAND:
  473.  
  474.           hwnd = WinWindowFromID(handle,(ULONG)TEST);
  475.  
  476.           switch ( SHORT1FROMMP ( parm1 )) {
  477.  
  478.           case INFO_OK:
  479.              WinDismissDlg ( hwnd, FALSE ) ;
  480.              return WinDefDlgProc (handle, mess, parm1, parm2);
  481.  
  482.           default:
  483.              return WinDefDlgProc (handle, mess, parm1, parm2);
  484.  
  485.       } /* endswitch */
  486.       break ;
  487.       
  488.       default:
  489.                return WinDefDlgProc(handle, mess, parm1, parm2);
  490.   }
  491.  
  492.   return(MRESULT)0;
  493. }
  494.  
  495.  
  496. VOID displayMenuInfo ( HWND hwndMenu,
  497.                        USHORT usMenuItem,
  498.                        HWND hwndClient )
  499. {
  500.    USHORT      usAllStyles ;
  501.    USHORT      usAttr ;
  502.    USHORT      usSzText ;
  503.    CHAR        achItemText [32] ;
  504.    CHAR        achText [128] ;
  505.  
  506.    usAllStyles = MIA_NODISMISS | MIA_FRAMED | MIA_CHECKED |
  507.                  MIA_DISABLED | MIA_HILITED ;
  508.  
  509.    usAttr = SHORT1FROMMR ( WinSendMsg ( hwndMenu,
  510.                            MM_QUERYITEMATTR,
  511.                            MPFROM2SHORT ( usMenuItem, TRUE ) ,
  512.                            MPFROMSHORT ( usAllStyles )) ) ;
  513.  
  514.    usSzText = SHORT1FROMMR ( WinSendMsg ( hwndMenu,
  515.                              MM_QUERYITEMTEXT,
  516.                              MPFROM2SHORT ( usMenuItem, 30 ) ,
  517.                              MPFROMP ( achItemText )) ) ;
  518.  
  519.    sprintf ( achText,
  520.              "Menu Item: \"%s\"\nMenu Item Styles are: 0x%04x",
  521.              usSzText ? achItemText : " (null) ",
  522.              usAttr ) ;
  523.  
  524.    WinMessageBox ( HWND_DESKTOP,
  525.                    hwndClient,
  526.                    achText,
  527.                    "Menu Information",
  528.                    0,
  529.                    MB_OK ) ;
  530.  
  531.    return ;
  532. }
  533. /* ********************************************************************** */
  534. MRESULT EXPENTRY USAProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
  535. {
  536. static char *p;
  537. static char buf[len_array];
  538. static char T1[255], T2[255];
  539. static double Num;
  540. int i, j, 
  541.     count,
  542.     result,
  543.     temp_j;
  544.  
  545. const char *temp1,
  546.            *temp2;
  547.  
  548. char temp;
  549.  
  550. IPT         Offset;
  551. ULONG         BytesToMLE;
  552.  
  553.  
  554. switch(msg)
  555.    {
  556.  
  557.   case WM_INITDLG:
  558.       {
  559.       NoPaint_En++;
  560.       WinSendDlgItemMsg( hwnd, 
  561.                                  ID_COLL_USA,
  562.                                  MLM_SETIMPORTEXPORT, 
  563.                                  MPFROMP ( buf ),  
  564.                                  MPFROMSHORT ( (USHORT) sizeof (buf ))
  565.                                 );
  566.  
  567.       WinSendDlgItemMsg(      hwnd, 
  568.                                  ID_COLL_USA,
  569.                                  MLM_FORMAT, 
  570.                                  (MPARAM)MLFIE_NOTRANS,  
  571.                                  NULL
  572.                                 );
  573.       {
  574.       char temp99[256];
  575.       sprintf(temp99,setlocale(LC_ALL, En_temp));
  576.       /*WinMessageBox(HWND_DESKTOP,hwndClient,temp99,
  577.                 "Calling 'setlocale'",0,MB_INFORMATION | MB_OK);*/
  578.       }
  579.  
  580.       i = 0;
  581.       p = "lion \0";
  582.       for (count=i;count<(width+i);count++)
  583.         buf[count]= *p++;
  584.       i+=width;
  585.  
  586.       p = "crow \0";
  587.       for (count=i;count<(width+i);count++)
  588.         buf[count]= *p++;
  589.       i+=width;
  590.  
  591.       p = "chimp\0";
  592.       for (count=i;count<(width+i);count++)
  593.         buf[count]= *p++;
  594.       i+=width;
  595.  
  596.       p = "loon \0";
  597.       for (count=i;count<(width+i);count++)
  598.         buf[count]= *p++;
  599.       i+=width;
  600.  
  601.       p = "llama\0";
  602.       for (count=i;count<(width+i);count++)
  603.         buf[count]= *p++;
  604.       i+=width;
  605.  
  606.       p = "camel\0";
  607.       for (count=i;count<(width+i);count++)
  608.         buf[count]= *p++;
  609.  
  610.       BytesToMLE = sizeof(buf);
  611.       for (j =0; j <= BytesToMLE; j++) 
  612.            if ( buf [ j ] == '\0' ) buf [ j ] = '\n';
  613.  
  614.       Offset = 0;
  615.       WinSendDlgItemMsg(hwnd,ID_COLL_USA, MLM_IMPORT, 
  616.             MPFROMP (&Offset),MPFROMP (&BytesToMLE));
  617.  
  618.       time(<ime);
  619.       ptmT = localtime(<ime); 
  620.       Num = num;
  621.       strftime(T2,18,"%x",ptmT);
  622.       WinSetDlgItemText(hwnd,ID_DATE_USA,T2);
  623.       strftime(T2,18,"%X",ptmT);
  624.       WinSetDlgItemText(hwnd,ID_TIME_USA,T2);
  625.       strfmon(T1,20,"%n",Num);
  626.       WinSetDlgItemText(hwnd,ID_MON_USA,T1);
  627.  
  628.       }
  629.      break;
  630.  
  631.  
  632.  
  633.  case WM_COMMAND:
  634.  
  635.     switch(SHORT1FROMMP(mp1))
  636.     {
  637.  
  638.       case ID_COLLATE_USA :
  639.         setlocale(LC_ALL, En_temp);
  640.     BytesToMLE = sizeof(buf);
  641.     for (j =0; j <= BytesToMLE; j++) 
  642.        if ( buf [ j ] == '\n' ) buf [ j ] = '\0';
  643.  
  644.     Offset = 0;
  645.     WinSendDlgItemMsg(hwnd,ID_COLL_USA, MLM_EXPORT, 
  646.                 MPFROMP (&Offset),MPFROMP (&BytesToMLE));
  647.     Offset = 0;
  648.     BytesToMLE = sizeof(buf);
  649.     WinSendDlgItemMsg(hwnd,ID_COLL_USA, MLM_DELETE, 
  650.                 MPFROMLONG (0),MPFROMLONG (BytesToMLE));
  651.  
  652.     for (i=0;i<len_array;i+=width)
  653.       {
  654.       j=i+width;
  655.       while(j < len_array)
  656.         {
  657.         temp1 = &buf[i];
  658.         temp2 = &buf[j];
  659.         result = strcoll(temp1, temp2);
  660.         if (result > 0)
  661.           {
  662.           temp_j = j;
  663.           for (count=i;count<width+i;count++)
  664.             {
  665.             temp = buf[count];
  666.             buf[count] = buf[temp_j];
  667.             buf[temp_j] = temp;
  668.             temp_j++;
  669.             }
  670.           }
  671.         j+=width;
  672.         }
  673.       }
  674.  
  675.     BytesToMLE = sizeof(buf);
  676.     for (j =0; j <= BytesToMLE; j++) 
  677.        if ( buf [ j ] == '\0' ) buf [ j ] = '\n';
  678.  
  679.     Offset = 0;
  680.     WinSendDlgItemMsg(hwnd,ID_COLL_USA, MLM_IMPORT, 
  681.                 MPFROMP (&Offset),MPFROMP (&BytesToMLE));
  682.     
  683.         break;
  684.  
  685.  
  686.         case ID_CANCEL_USA:    /* The Cancel pushbutton or Escape key */
  687.             WinPostMsg( hwndUSA, WM_CLOSE, NULL, NULL);
  688.             NoPaint_En--;
  689.             break;
  690.  
  691.         default :
  692.             break;
  693.          }
  694.        break;
  695.  
  696.       case WM_SIZE:
  697.           WinSetWindowPos( hwndUSA,HWND_TOP,
  698.             5,10,SHORT1FROMMP(mp2),SHORT2FROMMP(mp2),
  699.             SWP_MOVE | SWP_SIZE | SWP_SHOW);
  700.         break;
  701.  
  702.       case WM_ERASEBACKGROUND:
  703.         return (MRESULT) 1;
  704.  
  705.       case WM_HELP:
  706.           /*DisplayHelpPanel(SHORT1FROMMP(mp1));*/
  707.         break;
  708.  
  709.        default:
  710.          return(WinDefDlgProc(hwnd, msg, mp1, mp2));
  711.     } /* end switch */
  712.  
  713. return (MRESULT)0;
  714.  
  715. } /* end USAProc */
  716. /* ********************************************************************** */
  717. MRESULT EXPENTRY SPAINProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
  718. {
  719. static char *p;
  720. static char buf[len_array];
  721. static char T1[255], T2[255];
  722. static double Num;
  723. int i, j, 
  724.     count,
  725.     result,
  726.     temp_j;
  727.  
  728. const char *temp1,
  729.            *temp2;
  730.  
  731. char temp;  
  732.  
  733. IPT         Offset;
  734. ULONG         BytesToMLE;
  735.  
  736.  
  737. switch(msg)
  738.    {
  739.  
  740.   case WM_INITDLG:
  741.       {
  742.  
  743.       NoPaint_Es++;
  744.       WinSendDlgItemMsg( hwnd, 
  745.                                  ID_COLL_SPAIN,
  746.                                  MLM_SETIMPORTEXPORT, 
  747.                                  MPFROMP ( buf ),  
  748.                                  MPFROMSHORT ( (USHORT) sizeof (buf ))
  749.                                 );
  750.  
  751.       WinSendDlgItemMsg(      hwnd, 
  752.                                  ID_COLL_SPAIN,
  753.                                  MLM_FORMAT, 
  754.                                  (MPARAM)MLFIE_NOTRANS,  
  755.                                  NULL
  756.                                 );
  757.  
  758.       setlocale(LC_ALL, Es_temp);
  759.  
  760.       i = 0;
  761.       p = "lion \0";
  762.       for (count=i;count<(width+i);count++)
  763.         buf[count]= *p++;
  764.       i+=width;
  765.  
  766.       p = "chimp\0";
  767.       for (count=i;count<(width+i);count++)
  768.         buf[count]= *p++;
  769.       i+=width;
  770.  
  771.       p = "conch\0";
  772.       for (count=i;count<(width+i);count++)
  773.         buf[count]= *p++;
  774.       i+=width;
  775.  
  776.       p = "camel\0";
  777.       for (count=i;count<(width+i);count++)
  778.         buf[count]= *p++;
  779.       i+=width;
  780.  
  781.       p = "llama\0";
  782.       for (count=i;count<(width+i);count++)
  783.         buf[count]= *p++;
  784.       i+=width;
  785.  
  786.       p = "loon \0";
  787.       for (count=i;count<(width+i);count++)
  788.          buf[count]= *p++;
  789.  
  790.       BytesToMLE = sizeof(buf);
  791.       for (j =0; j <= BytesToMLE; j++) 
  792.            if ( buf [ j ] == '\0' ) buf [ j ] = '\n';
  793.  
  794.       Offset = 0;
  795.       WinSendDlgItemMsg(hwnd,ID_COLL_SPAIN, MLM_IMPORT, 
  796.             MPFROMP (&Offset),MPFROMP (&BytesToMLE));
  797.  
  798.       time(<ime);
  799.       ptmT = localtime(<ime); 
  800.       Num = num * 139.65;
  801.       strftime(T2,18,"%x",ptmT);
  802.       WinSetDlgItemText(hwnd,ID_DATE_SPAIN,T2);
  803.       strftime(T2,18,"%X",ptmT);
  804.       WinSetDlgItemText(hwnd,ID_TIME_SPAIN,T2);
  805.       strfmon(T1,20,"%n",Num);
  806.       WinSetDlgItemText(hwnd,ID_MON_SPAIN,T1);
  807.  
  808.  
  809.       }
  810.      break;
  811.  
  812.  
  813.  
  814.  case WM_COMMAND:
  815.  
  816.     switch(SHORT1FROMMP(mp1))
  817.     {
  818.  
  819.       case ID_COLLATE_SPAIN :
  820.         setlocale(LC_ALL, Es_temp);
  821.     BytesToMLE = sizeof(buf);
  822.     for (j =0; j <= BytesToMLE; j++) 
  823.        if ( buf [ j ] == '\n' ) buf [ j ] = '\0';
  824.  
  825.     Offset = 0;
  826.     WinSendDlgItemMsg(hwnd,ID_COLL_SPAIN, MLM_EXPORT, 
  827.                 MPFROMP (&Offset),MPFROMP (&BytesToMLE));
  828.     Offset = 0;
  829.     BytesToMLE = sizeof(buf);
  830.     WinSendDlgItemMsg(hwnd,ID_COLL_SPAIN, MLM_DELETE, 
  831.                 MPFROMLONG (0),MPFROMLONG (BytesToMLE));
  832.  
  833.     for (i=0;i<len_array;i+=width)
  834.       {
  835.       j=i+width;
  836.       while(j < len_array)
  837.         {
  838.         temp1 = &buf[i];
  839.         temp2 = &buf[j];
  840.         result = strcoll(temp1, temp2);
  841.         if (result > 0)
  842.           {
  843.           temp_j = j;
  844.           for (count=i;count<width+i;count++)
  845.             {
  846.             temp = buf[count];
  847.             buf[count] = buf[temp_j];
  848.             buf[temp_j] = temp;
  849.             temp_j++;
  850.             }
  851.           }
  852.         j+=width;
  853.         }
  854.       }
  855.  
  856.     BytesToMLE = sizeof(buf);
  857.     for (j =0; j <= BytesToMLE; j++) 
  858.        if ( buf [ j ] == '\0' ) buf [ j ] = '\n';
  859.  
  860.     Offset = 0;
  861.     WinSendDlgItemMsg(hwnd,ID_COLL_SPAIN, MLM_IMPORT, 
  862.                 MPFROMP (&Offset),MPFROMP (&BytesToMLE));
  863.     
  864.         break;
  865.  
  866.  
  867.         case ID_CANCEL_SPAIN:    /* The Cancel pushbutton or Escape key */
  868.             WinPostMsg( hwndSPAIN, WM_CLOSE, NULL, NULL);
  869.             NoPaint_Es--;
  870.             break;
  871.  
  872.         default :
  873.             break;
  874.          }
  875.        break;
  876.  
  877.       case WM_SIZE:
  878.           WinSetWindowPos( hwndSPAIN,HWND_TOP,
  879.             120,5,SHORT1FROMMP(mp2),SHORT2FROMMP(mp2),
  880.             SWP_SHOW);
  881.         break;
  882.  
  883.       case WM_ERASEBACKGROUND:
  884.         return (MRESULT) 1;
  885.  
  886.       case WM_HELP:
  887.           /*DisplayHelpPanel(SHORT1FROMMP(mp1));*/
  888.         break;
  889.  
  890.        default:
  891.          return(WinDefDlgProc(hwnd, msg, mp1, mp2));
  892.     } /* end switch */
  893.  
  894. return (MRESULT)0;
  895.  
  896. } /* end SPAINProc */
  897.  
  898. /* ********************************************************************** */
  899. MRESULT EXPENTRY FRANCEProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
  900. {
  901. static char *p;
  902. static char buf[len_array];
  903. static char T1[255], T2[255];
  904. static double Num;
  905. int i, j, 
  906.     count,
  907.     result,
  908.     temp_j;
  909.  
  910. const char *temp1,
  911.            *temp2;
  912.  
  913. char temp;
  914.  
  915. IPT         Offset;
  916. ULONG         BytesToMLE;
  917.  
  918.  
  919. switch(msg)
  920.    {
  921.  
  922.   case WM_INITDLG:
  923.       {
  924.       NoPaint_Fr++;
  925.       WinSendDlgItemMsg( hwnd, 
  926.                                  ID_COLL_FRANCE,
  927.                                  MLM_SETIMPORTEXPORT, 
  928.                                  MPFROMP ( buf ),  
  929.                                  MPFROMSHORT ( (USHORT) sizeof (buf ))
  930.                                 );
  931.  
  932.       WinSendDlgItemMsg(      hwnd, 
  933.                                  ID_COLL_FRANCE,
  934.                                  MLM_FORMAT, 
  935.                                  (MPARAM)MLFIE_NOTRANS,  
  936.                                  NULL
  937.                                 );
  938.       setlocale(LC_ALL, Fr_temp);
  939.  
  940.       i = 0;
  941.       p = "lion \0";
  942.       for (count=i;count<(width+i);count++)
  943.         buf[count]= *p++;
  944.       i+=width;
  945.  
  946.       p = "chimp\0";
  947.       for (count=i;count<(width+i);count++)
  948.         buf[count]= *p++;
  949.       i+=width;
  950.  
  951.       p = "conch\0";
  952.       for (count=i;count<(width+i);count++)
  953.         buf[count]= *p++;
  954.       i+=width;
  955.  
  956.       p = "loon \0";
  957.       for (count=i;count<(width+i);count++)
  958.         buf[count]= *p++;
  959.       i+=width;
  960.  
  961.       p = "llama\0";
  962.       for (count=i;count<(width+i);count++)
  963.         buf[count]= *p++;
  964.       i+=width;
  965.  
  966.       p = "camel\0";
  967.       for (count=i;count<(width+i);count++)
  968.         buf[count]= *p++;
  969.  
  970.       BytesToMLE = sizeof(buf);
  971.       for (j =0; j <= BytesToMLE; j++) 
  972.            if ( buf [ j ] == '\0' ) buf [ j ] = '\n';
  973.  
  974.       Offset = 0;
  975.  
  976.       WinSendDlgItemMsg(hwnd,ID_COLL_FRANCE, MLM_IMPORT, 
  977.             MPFROMP (&Offset),MPFROMP (&BytesToMLE));
  978.  
  979.       time(<ime);
  980.       ptmT = localtime(<ime); 
  981.       Num = num * 5.885;
  982.       strftime(T2,18,"%x",ptmT);
  983.       WinSetDlgItemText(hwnd,ID_DATE_FRANCE,T2);
  984.       strftime(T2,18,"%X",ptmT);
  985.       WinSetDlgItemText(hwnd,ID_TIME_FRANCE,T2);
  986.       strfmon(T1,20,"%n",Num);
  987.       WinSetDlgItemText(hwnd,ID_MON_FRANCE,T1);
  988.  
  989.  
  990.       }
  991.      break;
  992.  
  993.  
  994.  
  995.  case WM_COMMAND:
  996.  
  997.     switch(SHORT1FROMMP(mp1))
  998.     {
  999.  
  1000.       case ID_COLLATE_FRANCE :
  1001.         setlocale(LC_ALL, Fr_temp);
  1002.  
  1003.     BytesToMLE = sizeof(buf);
  1004.     for (j =0; j <= BytesToMLE; j++) 
  1005.        if ( buf [ j ] == '\n' ) buf [ j ] = '\0';
  1006.  
  1007.     Offset = 0;
  1008.     WinSendDlgItemMsg(hwnd,ID_COLL_FRANCE, MLM_EXPORT, 
  1009.                 MPFROMP (&Offset),MPFROMP (&BytesToMLE));
  1010.     Offset = 0;
  1011.     BytesToMLE = sizeof(buf);
  1012.     WinSendDlgItemMsg(hwnd,ID_COLL_FRANCE, MLM_DELETE, 
  1013.                 MPFROMLONG (0),MPFROMLONG (BytesToMLE));
  1014.  
  1015.     for (i=0;i<len_array;i+=width)
  1016.       {
  1017.       j=i+width;
  1018.       while(j < len_array)
  1019.         {
  1020.         temp1 = &buf[i];
  1021.         temp2 = &buf[j];
  1022.         result = strcoll(temp1, temp2);
  1023.         if (result > 0)
  1024.           {
  1025.           temp_j = j;
  1026.           for (count=i;count<width+i;count++)
  1027.             {
  1028.             temp = buf[count];
  1029.             buf[count] = buf[temp_j];
  1030.             buf[temp_j] = temp;
  1031.             temp_j++;
  1032.             }
  1033.           }
  1034.         j+=width;
  1035.         }
  1036.       }
  1037.  
  1038.     BytesToMLE = sizeof(buf);
  1039.     for (j =0; j <= BytesToMLE; j++) 
  1040.        if ( buf [ j ] == '\0' ) buf [ j ] = '\n';
  1041.  
  1042.     Offset = 0;
  1043.     WinSendDlgItemMsg(hwnd,ID_COLL_FRANCE, MLM_IMPORT, 
  1044.                 MPFROMP (&Offset),MPFROMP (&BytesToMLE));
  1045.     
  1046.         break;
  1047.  
  1048.  
  1049.         case ID_CANCEL_FRANCE:    /* The Cancel pushbutton or Escape key */
  1050.             WinPostMsg( hwndFRANCE, WM_CLOSE, NULL, NULL);
  1051.             NoPaint_Fr--;
  1052.             break;
  1053.  
  1054.         default :
  1055.             break;
  1056.          }
  1057.        break;
  1058.  
  1059.       case WM_SIZE:
  1060.           WinSetWindowPos( hwndFRANCE,HWND_TOP,
  1061.             250,10,SHORT1FROMMP(mp2),SHORT2FROMMP(mp2),
  1062.             SWP_SHOW);
  1063.         break;
  1064.  
  1065.       case WM_ERASEBACKGROUND:
  1066.         return (MRESULT) 1;
  1067.  
  1068.       case WM_HELP:
  1069.           /*DisplayHelpPanel(SHORT1FROMMP(mp1));*/
  1070.         break;
  1071.  
  1072.        default:
  1073.          return(WinDefDlgProc(hwnd, msg, mp1, mp2));
  1074.     } /* end switch */
  1075.  
  1076. return (MRESULT)0;
  1077.  
  1078. } /* end FRANCEProc */
  1079. /* ********************************************************************** */
  1080. MRESULT EXPENTRY GERMANYProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
  1081. {
  1082. static char *p;
  1083. static char buf[len_array];
  1084. static char T1[255], T2[255];
  1085. static double Num;
  1086. int i, j, 
  1087.     count,
  1088.     result,
  1089.     temp_j;
  1090.  
  1091. const char *temp1,
  1092.            *temp2;
  1093.  
  1094. char temp;
  1095.  
  1096. IPT         Offset;
  1097. ULONG         BytesToMLE;
  1098.  
  1099. switch(msg)
  1100.    {
  1101.  
  1102.   case WM_INITDLG:
  1103.       {
  1104.       NoPaint_De++;
  1105.       WinSendDlgItemMsg( hwnd, 
  1106.                                  ID_COLL_GERMANY,
  1107.                                  MLM_SETIMPORTEXPORT, 
  1108.                                  MPFROMP ( buf ),  
  1109.                                  MPFROMSHORT ( (USHORT) sizeof (buf ))
  1110.                                 );
  1111.  
  1112.       WinSendDlgItemMsg(      hwnd, 
  1113.                                  ID_COLL_GERMANY,
  1114.                                  MLM_FORMAT, 
  1115.                                  (MPARAM)MLFIE_NOTRANS,  
  1116.                                  NULL
  1117.                                 );
  1118.       setlocale(LC_ALL, De_temp);
  1119.  
  1120.       i = 0;
  1121.       p = "conch\0";
  1122.       for (count=i;count<(width+i);count++)
  1123.         buf[count]= *p++;
  1124.       i+=width;
  1125.  
  1126.       p = "chimp\0";
  1127.       for (count=i;count<(width+i);count++)
  1128.         buf[count]= *p++;
  1129.       i+=width;
  1130.  
  1131.       p = "lynx \0";
  1132.       for (count=i;count<(width+i);count++)
  1133.         buf[count]= *p++;
  1134.       i+=width;
  1135.  
  1136.       p = "lion \0";
  1137.       for (count=i;count<(width+i);count++)
  1138.         buf[count]= *p++;
  1139.       i+=width;
  1140.  
  1141.       p = "llama\0";
  1142.       for (count=i;count<(width+i);count++)
  1143.         buf[count]= *p++;
  1144.       i+=width;
  1145.  
  1146.       p = "camel\0";
  1147.       for (count=i;count<(width+i);count++)
  1148.         buf[count]= *p++;
  1149.  
  1150.       BytesToMLE = sizeof(buf);
  1151.       for (j =0; j <= BytesToMLE; j++) 
  1152.            if ( buf [ j ] == '\0' ) buf [ j ] = '\n';
  1153.  
  1154.       Offset = 0;
  1155.  
  1156.       WinSendDlgItemMsg(hwnd,ID_COLL_GERMANY, MLM_IMPORT, 
  1157.             MPFROMP (&Offset),MPFROMP (&BytesToMLE));
  1158.  
  1159.       time(<ime);
  1160.       ptmT = localtime(<ime); 
  1161.       Num = num * 1.740;
  1162.       strftime(T2,18,"%x",ptmT);
  1163.       WinSetDlgItemText(hwnd,ID_DATE_GERMANY,T2);
  1164.       strftime(T2,18,"%X",ptmT);
  1165.       WinSetDlgItemText(hwnd,ID_TIME_GERMANY,T2);
  1166.       strfmon(T1,20,"%n",Num);
  1167.       WinSetDlgItemText(hwnd,ID_MON_GERMANY,T1);
  1168.  
  1169.       }
  1170.      break;
  1171.  
  1172.  
  1173.  
  1174.  case WM_COMMAND:
  1175.  
  1176.     switch(SHORT1FROMMP(mp1))
  1177.     {
  1178.  
  1179.       case ID_COLLATE_GERMANY :
  1180.         setlocale(LC_ALL, De_temp);
  1181.     BytesToMLE = sizeof(buf);
  1182.     for (j =0; j <= BytesToMLE; j++) 
  1183.        if ( buf [ j ] == '\n' ) buf [ j ] = '\0';
  1184.  
  1185.     Offset = 0;
  1186.     WinSendDlgItemMsg(hwnd,ID_COLL_GERMANY, MLM_EXPORT, 
  1187.                 MPFROMP (&Offset),MPFROMP (&BytesToMLE));
  1188.     Offset = 0;
  1189.     BytesToMLE = sizeof(buf);
  1190.     WinSendDlgItemMsg(hwnd,ID_COLL_GERMANY, MLM_DELETE, 
  1191.                 MPFROMLONG (0),MPFROMLONG (BytesToMLE));
  1192.  
  1193.     for (i=0;i<len_array;i+=width)
  1194.       {
  1195.       j=i+width;
  1196.       while(j < len_array)
  1197.         {
  1198.         temp1 = &buf[i];
  1199.         temp2 = &buf[j];
  1200.         result = strcoll(temp1, temp2);
  1201.         if (result > 0)
  1202.           {
  1203.           temp_j = j;
  1204.           for (count=i;count<width+i;count++)
  1205.             {
  1206.             temp = buf[count];
  1207.             buf[count] = buf[temp_j];
  1208.             buf[temp_j] = temp;
  1209.             temp_j++;
  1210.             }
  1211.           }
  1212.         j+=width;
  1213.         }
  1214.       }
  1215.  
  1216.     BytesToMLE = sizeof(buf);
  1217.     for (j =0; j <= BytesToMLE; j++) 
  1218.        if ( buf [ j ] == '\0' ) buf [ j ] = '\n';
  1219.  
  1220.     Offset = 0;
  1221.     WinSendDlgItemMsg(hwnd,ID_COLL_GERMANY, MLM_IMPORT, 
  1222.                 MPFROMP (&Offset),MPFROMP (&BytesToMLE));
  1223.     
  1224.         break;
  1225.  
  1226.  
  1227.         case ID_CANCEL_GERMANY:    /* The Cancel pushbutton or Escape key */
  1228.             WinPostMsg( hwndGERMANY, WM_CLOSE, NULL, NULL);
  1229.             NoPaint_De--;
  1230.             break;
  1231.  
  1232.         default :
  1233.             break;
  1234.          }
  1235.        break;
  1236.  
  1237.       case WM_SIZE:
  1238.           WinSetWindowPos( hwndGERMANY,HWND_TOP,
  1239.             5,10,SHORT1FROMMP(mp2),SHORT2FROMMP(mp2),
  1240.             SWP_MOVE | SWP_SIZE | SWP_SHOW);
  1241.         break;
  1242.  
  1243.       case WM_ERASEBACKGROUND:
  1244.         return (MRESULT) 1;
  1245.  
  1246.       case WM_HELP:
  1247.           /*DisplayHelpPanel(SHORT1FROMMP(mp1));*/
  1248.         break;
  1249.  
  1250.        default:
  1251.          return(WinDefDlgProc(hwnd, msg, mp1, mp2));
  1252.     } /* end switch */
  1253.  
  1254. return (MRESULT)0;
  1255.  
  1256. } /* end GERMANYProc */
  1257. /* ********************************************************************** */
  1258. MRESULT EXPENTRY JAPANProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
  1259. {
  1260. static char *p;
  1261. static char buf[len_array];
  1262. static char T1[255], T2[255];
  1263. static double Num;
  1264. int i, j, 
  1265.     count,
  1266.     result,
  1267.     temp_j;
  1268.  
  1269. const char *temp1,
  1270.            *temp2;
  1271.  
  1272. char temp;
  1273.  
  1274. IPT         Offset;
  1275. ULONG         BytesToMLE;
  1276.  
  1277. switch(msg)
  1278.    {
  1279.  
  1280.   case WM_INITDLG:
  1281.       {
  1282.       NoPaint_Ja++;
  1283.       WinSendDlgItemMsg( hwnd, 
  1284.                                  ID_COLL_JAPAN,
  1285.                                  MLM_SETIMPORTEXPORT, 
  1286.                                  MPFROMP ( buf ),  
  1287.                                  MPFROMSHORT ( (USHORT) sizeof (buf ))
  1288.                                 );
  1289.  
  1290.       WinSendDlgItemMsg(      hwnd, 
  1291.                                  ID_COLL_JAPAN,
  1292.                                  MLM_FORMAT, 
  1293.                                  (MPARAM)MLFIE_NOTRANS,  
  1294.                                  NULL
  1295.                                 );
  1296.       setlocale(LC_ALL, Ja_temp);
  1297.  
  1298.       i = 0;
  1299.       p = "lion \0";
  1300.       for (count=i;count<(width+i);count++)
  1301.         buf[count]= *p++;
  1302.       i+=width;
  1303.  
  1304.       p = "chimp\0";
  1305.       for (count=i;count<(width+i);count++)
  1306.         buf[count]= *p++;
  1307.       i+=width;
  1308.  
  1309.       p = "loon \0";
  1310.       for (count=i;count<(width+i);count++)
  1311.         buf[count]= *p++;
  1312.       i+=width;
  1313.  
  1314.       p = "camel\0";
  1315.       for (count=i;count<(width+i);count++)
  1316.         buf[count]= *p++;
  1317.       i+=width;
  1318.  
  1319.       p = "llama\0";
  1320.       for (count=i;count<(width+i);count++)
  1321.         buf[count]= *p++;
  1322.       i+=width;
  1323.  
  1324.       p = "conch\0";
  1325.       for (count=i;count<(width+i);count++)
  1326.         buf[count]= *p++;
  1327.  
  1328.       BytesToMLE = sizeof(buf);
  1329.       for (j =0; j <= BytesToMLE; j++) 
  1330.            if ( buf [ j ] == '\0' ) buf [ j ] = '\n';
  1331.  
  1332.       Offset = 0;
  1333.  
  1334.       WinSendDlgItemMsg(hwnd,ID_COLL_JAPAN, MLM_IMPORT, 
  1335.             MPFROMP (&Offset),MPFROMP (&BytesToMLE));
  1336.  
  1337.       time(<ime);
  1338.       ptmT = localtime(<ime); 
  1339.       Num = num * 108.65;
  1340.       strftime(T2,20,"%x",ptmT);
  1341.       WinSetDlgItemText(hwnd,ID_DATE_JAPAN,T2);
  1342.       strftime(T2,20,"%X",ptmT);
  1343.       WinSetDlgItemText(hwnd,ID_TIME_JAPAN,T2);
  1344.       strfmon(T1,20,"%n",Num);
  1345.       WinSetDlgItemText(hwnd,ID_MON_JAPAN,T1);
  1346.  
  1347.       }
  1348.      break;
  1349.  
  1350.  
  1351.  
  1352.  case WM_COMMAND:
  1353.  
  1354.     switch(SHORT1FROMMP(mp1))
  1355.     {
  1356.  
  1357.       case ID_COLLATE_JAPAN :
  1358.  
  1359.         setlocale(LC_ALL, Ja_temp);
  1360.  
  1361.     BytesToMLE = sizeof(buf);
  1362.     for (j =0; j <= BytesToMLE; j++) 
  1363.        if ( buf [ j ] == '\n' ) buf [ j ] = '\0';
  1364.  
  1365.     Offset = 0;
  1366.     WinSendDlgItemMsg(hwnd,ID_COLL_JAPAN, MLM_EXPORT, 
  1367.                 MPFROMP (&Offset),MPFROMP (&BytesToMLE));
  1368.     Offset = 0;
  1369.     BytesToMLE = sizeof(buf);
  1370.     WinSendDlgItemMsg(hwnd,ID_COLL_JAPAN, MLM_DELETE, 
  1371.                 MPFROMLONG (0),MPFROMLONG (BytesToMLE));
  1372.  
  1373.     for (i=0;i<len_array;i+=width)
  1374.       {
  1375.       j=i+width;
  1376.       while(j < len_array)
  1377.         {
  1378.         temp1 = &buf[i];
  1379.         temp2 = &buf[j];
  1380.         result = strcoll(temp1, temp2);
  1381.         if (result > 0)
  1382.           {
  1383.           temp_j = j;
  1384.           for (count=i;count<width+i;count++)
  1385.             {
  1386.             temp = buf[count];
  1387.             buf[count] = buf[temp_j];
  1388.             buf[temp_j] = temp;
  1389.             temp_j++;
  1390.             }
  1391.           }
  1392.         j+=width;
  1393.         }
  1394.       }
  1395.  
  1396.     BytesToMLE = sizeof(buf);
  1397.     for (j =0; j <= BytesToMLE; j++) 
  1398.        if ( buf [ j ] == '\0' ) buf [ j ] = '\n';
  1399.  
  1400.     Offset = 0;
  1401.     WinSendDlgItemMsg(hwnd,ID_COLL_JAPAN, MLM_IMPORT, 
  1402.                 MPFROMP (&Offset),MPFROMP (&BytesToMLE));
  1403.     
  1404.         break;
  1405.  
  1406.  
  1407.         case ID_CANCEL_JAPAN:    /* The Cancel pushbutton or Escape key */
  1408.             WinPostMsg( hwndJAPAN, WM_CLOSE, NULL, NULL);
  1409.             NoPaint_Ja--;
  1410.             break;
  1411.  
  1412.         default :
  1413.             break;
  1414.          }
  1415.        break;
  1416.  
  1417.       case WM_SIZE:
  1418.           WinSetWindowPos( hwndJAPAN,HWND_TOP,
  1419.             5,10,SHORT1FROMMP(mp2),SHORT2FROMMP(mp2),
  1420.             SWP_MOVE | SWP_SIZE | SWP_SHOW);
  1421.         break;
  1422.  
  1423.       case WM_ERASEBACKGROUND:
  1424.         return (MRESULT) 1;
  1425.  
  1426.       case WM_HELP:
  1427.           /*DisplayHelpPanel(SHORT1FROMMP(mp1));*/
  1428.         break;
  1429.  
  1430.        default:
  1431.          return(WinDefDlgProc(hwnd, msg, mp1, mp2));
  1432.     } /* end switch */
  1433.  
  1434. return (MRESULT)0;
  1435.  
  1436. } /* end JAPANProc */
  1437.  
  1438. /* ********************************************************************** */
  1439. MRESULT EXPENTRY SWEDENProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
  1440. {
  1441. static char *p;
  1442. static char buf[len_array];
  1443. static char T1[255], T2[255];
  1444. static double Num;
  1445. int i, j, 
  1446.     count,
  1447.     result,
  1448.     temp_j;
  1449.  
  1450. const char *temp1,
  1451.            *temp2;
  1452.  
  1453. char temp;
  1454.  
  1455. IPT         Offset;
  1456. ULONG         BytesToMLE;
  1457.  
  1458. switch(msg)
  1459.    {
  1460.  
  1461.   case WM_INITDLG:
  1462.       {
  1463.       NoPaint_Sv++;
  1464.       WinSendDlgItemMsg( hwnd, 
  1465.                                  ID_COLL_SWEDEN,
  1466.                                  MLM_SETIMPORTEXPORT, 
  1467.                                  MPFROMP ( buf ),  
  1468.                                  MPFROMSHORT ( (USHORT) sizeof (buf ))
  1469.                                 );
  1470.  
  1471.       WinSendDlgItemMsg(      hwnd, 
  1472.                                  ID_COLL_SWEDEN,
  1473.                                  MLM_FORMAT, 
  1474.                                  (MPARAM)MLFIE_NOTRANS,  
  1475.                                  NULL
  1476.                                 );
  1477.       setlocale(LC_ALL, Sv_temp);
  1478.  
  1479.       i = 0;
  1480.       p = "lion \0";
  1481.       for (count=i;count<(width+i);count++)
  1482.         buf[count]= *p++;
  1483.       i+=width;
  1484.  
  1485.       p = "chimp\0";
  1486.       for (count=i;count<(width+i);count++)
  1487.         buf[count]= *p++;
  1488.       i+=width;
  1489.  
  1490.       p = "conch\0";
  1491.       for (count=i;count<(width+i);count++)
  1492.         buf[count]= *p++;
  1493.       i+=width;
  1494.  
  1495.       p = "loon \0";
  1496.       for (count=i;count<(width+i);count++)
  1497.         buf[count]= *p++;
  1498.       i+=width;
  1499.  
  1500.       p = "llama\0";
  1501.       for (count=i;count<(width+i);count++)
  1502.         buf[count]= *p++;
  1503.       i+=width;
  1504.  
  1505.       p = "camel\0";
  1506.       for (count=i;count<(width+i);count++)
  1507.         buf[count]= *p++;
  1508.  
  1509.       BytesToMLE = sizeof(buf);
  1510.       for (j =0; j <= BytesToMLE; j++) 
  1511.            if ( buf [ j ] == '\0' ) buf [ j ] = '\n';
  1512.  
  1513.       Offset = 0;
  1514.  
  1515.       WinSendDlgItemMsg(hwnd,ID_COLL_SWEDEN, MLM_IMPORT, 
  1516.             MPFROMP (&Offset),MPFROMP (&BytesToMLE));
  1517.  
  1518.       time(<ime);
  1519.       ptmT = localtime(<ime); 
  1520.       Num = num * 7.908;
  1521.       strftime(T2,10,"%x",ptmT);
  1522.       WinSetDlgItemText(hwnd,ID_DATE_SWEDEN,T2);
  1523.       strftime(T2,10,"%X",ptmT);
  1524.       WinSetDlgItemText(hwnd,ID_TIME_SWEDEN,T2);
  1525.       strfmon(T1,20,"%n",Num);
  1526.       WinSetDlgItemText(hwnd,ID_MON_SWEDEN,T1);
  1527.  
  1528.  
  1529.       }
  1530.      break;
  1531.  
  1532.  
  1533.  
  1534.  case WM_COMMAND:
  1535.  
  1536.     switch(SHORT1FROMMP(mp1))
  1537.     {
  1538.  
  1539.       case ID_COLLATE_SWEDEN :
  1540.         setlocale(LC_ALL, Sv_temp);
  1541.     BytesToMLE = sizeof(buf);
  1542.     for (j =0; j <= BytesToMLE; j++) 
  1543.        if ( buf [ j ] == '\n' ) buf [ j ] = '\0';
  1544.  
  1545.     Offset = 0;
  1546.     WinSendDlgItemMsg(hwnd,ID_COLL_SWEDEN, MLM_EXPORT, 
  1547.                 MPFROMP (&Offset),MPFROMP (&BytesToMLE));
  1548.     Offset = 0;
  1549.     BytesToMLE = sizeof(buf);
  1550.     WinSendDlgItemMsg(hwnd,ID_COLL_SWEDEN, MLM_DELETE, 
  1551.                 MPFROMLONG (0),MPFROMLONG (BytesToMLE));
  1552.  
  1553.     for (i=0;i<len_array;i+=width)
  1554.       {
  1555.       j=i+width;
  1556.       while(j < len_array)
  1557.         {
  1558.         temp1 = &buf[i];
  1559.         temp2 = &buf[j];
  1560.         result = strcoll(temp1, temp2);
  1561.         if (result > 0)
  1562.           {
  1563.           temp_j = j;
  1564.           for (count=i;count<width+i;count++)
  1565.             {
  1566.             temp = buf[count];
  1567.             buf[count] = buf[temp_j];
  1568.             buf[temp_j] = temp;
  1569.             temp_j++;
  1570.             }
  1571.           }
  1572.         j+=width;
  1573.         }
  1574.       }
  1575.  
  1576.     BytesToMLE = sizeof(buf);
  1577.     for (j =0; j <= BytesToMLE; j++) 
  1578.        if ( buf [ j ] == '\0' ) buf [ j ] = '\n';
  1579.  
  1580.     Offset = 0;
  1581.     WinSendDlgItemMsg(hwnd,ID_COLL_SWEDEN, MLM_IMPORT, 
  1582.                 MPFROMP (&Offset),MPFROMP (&BytesToMLE));
  1583.     
  1584.         break;
  1585.  
  1586.  
  1587.         case ID_CANCEL_SWEDEN:    /* The Cancel pushbutton or Escape key */
  1588.             WinPostMsg( hwndSWEDEN, WM_CLOSE, NULL, NULL);
  1589.             NoPaint_Sv--;
  1590.             break;
  1591.  
  1592.         default :
  1593.             break;
  1594.          }
  1595.        break;
  1596.  
  1597.       case WM_SIZE:
  1598.           WinSetWindowPos( hwndSWEDEN,HWND_TOP,
  1599.             5,10,SHORT1FROMMP(mp2),SHORT2FROMMP(mp2),
  1600.             SWP_MOVE | SWP_SIZE | SWP_SHOW);
  1601.         break;
  1602.  
  1603.       case WM_ERASEBACKGROUND:
  1604.         return (MRESULT) 1;
  1605.  
  1606.       case WM_HELP:
  1607.           /*DisplayHelpPanel(SHORT1FROMMP(mp1));*/
  1608.         break;
  1609.  
  1610.        default:
  1611.          return(WinDefDlgProc(hwnd, msg, mp1, mp2));
  1612.     } /* end switch */
  1613.  
  1614. return (MRESULT)0;
  1615.  
  1616. } /* end SWEDENProc */
  1617.  
  1618.  
  1619.