home *** CD-ROM | disk | FTP | other *** search
- #define INCL_WIN
- #include <os2.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
- #include <time.h>
- #include <wchar.h>
- #include <locale.h>
- #include "xpg4.h"
-
- #define CLS_CLIENT "MyClass"
- #define width 6
- #define num_elements 6
- #define len_array (num_elements * width)
-
- char Bucks[255];
- double num = 1000.00;
- time_t ltime;
- struct tm *ptmT = NULL;
-
- UCHAR locale_temp[200] = "\\xpg4\\locale";
- UCHAR En_temp[200];
- UCHAR Es_temp[200];
- UCHAR De_temp[200];
- UCHAR Sv_temp[200];
- UCHAR Fr_temp[200];
- UCHAR Ja_temp[200];
-
- int NoPaint_En = 0;
- int NoPaint_Es = 0;
- int NoPaint_De = 0;
- int NoPaint_Sv = 0;
- int NoPaint_Fr = 0;
- int NoPaint_Ja = 0;
-
- HWND hwndUSA;
- HWND hwndSPAIN;
- HWND hwndFRANCE;
- HWND hwndGERMANY;
- HWND hwndJAPAN;
- HWND hwndSWEDEN;
- HWND hwnd;
- HWND hwndFrame;
- HWND hwndClient;
-
- VOID displayMenuInfo ( HWND hwndMenu,
- USHORT usMenuItem,
- HWND hwndClient ) ;
- MRESULT EXPENTRY ClientWndProc ( HWND hwndWnd,
- ULONG ulMsg,
- MPARAM mpParm1,
- MPARAM mpParm2 ) ;
- VOID displayInfo ( HWND hwndMenu,
- USHORT usMenuItem,
- HWND hwndClient );
- MRESULT EXPENTRY dialog_func (HWND handle, ULONG mess, MPARAM parm1, MPARAM parm2);
- MRESULT EXPENTRY info_dialog_func (HWND handle, ULONG mess, MPARAM parm1, MPARAM parm2);
- MRESULT EXPENTRY USAProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
- MRESULT EXPENTRY SPAINProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
- MRESULT EXPENTRY FRANCEProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
- MRESULT EXPENTRY GERMANYProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
- MRESULT EXPENTRY JAPANProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
- MRESULT EXPENTRY SWEDENProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
-
-
-
-
-
-
- INT main ( VOID )
- {
- HAB habAnchor ;
- HMQ hmqQueue ;
- ULONG ulFlags ;
- BOOL bLoop ;
- QMSG qmMsg ;
-
- habAnchor = WinInitialize ( 0 ) ;
- hmqQueue = WinCreateMsgQueue ( habAnchor, 0 ) ;
-
- WinRegisterClass ( habAnchor,
- CLS_CLIENT,
- ClientWndProc,
- CS_SIZEREDRAW,
- 0 ) ;
-
- ulFlags = FCF_STANDARD & ~FCF_SHELLPOSITION ;
-
- hwndFrame = WinCreateStdWindow ( HWND_DESKTOP,
- 0,
- &ulFlags,
- CLS_CLIENT,
- "XPG4 DEMO",
- 0,
- NULLHANDLE,
- RES_CLIENT,
- &hwndClient ) ;
-
- if ( hwndFrame != NULLHANDLE ) {
-
- WinSetWindowPos ( hwndFrame,
- NULLHANDLE,
- 50,
- 50,
- 557,
- 395,
- SWP_SIZE |
- SWP_MOVE |
- SWP_ACTIVATE |
- SWP_SHOW ) ;
-
- bLoop = WinGetMsg ( habAnchor,
- &qmMsg,
- NULLHANDLE,
- 0,
- 0 ) ;
- while ( bLoop ) {
- WinDispatchMsg ( habAnchor, &qmMsg ) ;
- bLoop = WinGetMsg ( habAnchor,
- &qmMsg,
- NULLHANDLE,
- 0,
- 0 ) ;
- } /* endwhile */
-
- WinDestroyWindow ( hwndFrame ) ;
- } /* endif */
-
- WinDestroyMsgQueue ( hmqQueue ) ;
- WinTerminate ( habAnchor ) ;
- return 0 ;
- }
-
- MRESULT EXPENTRY ClientWndProc ( HWND hwndWnd,
- ULONG ulMsg,
- MPARAM mpParm1,
- MPARAM mpParm2 )
- {
- switch ( ulMsg ) {
-
- case WM_CREATE:
- {
- HPS hpsWnd ;
- HBITMAP hbmBitmap ;
- MENUITEM miItem ;
- HWND hwndMenu ;
-
- hpsWnd = WinGetPS ( hwndWnd ) ;
- hbmBitmap = GpiLoadBitmap ( hpsWnd,
- NULLHANDLE,
- IDB_BITMAP,
- 500,
- 350 ) ;
- WinReleasePS ( hpsWnd ) ;
-
- miItem.iPosition = 0 ;
- miItem.afStyle = MIS_BITMAP ;
- miItem.afAttribute = 0 ;
- miItem.id = IDM_BITMAP ;
- miItem.hwndSubMenu = NULLHANDLE ;
- miItem.hItem = hbmBitmap ;
-
- hwndMenu = WinWindowFromID ( WinQueryWindow ( hwndWnd,
- QW_PARENT ) ,
- FID_MENU ) ;
- WinSendMsg ( hwndMenu,
- MM_SETITEM,
- MPFROM2SHORT ( 0, TRUE ) ,
- MPFROMP ( &miItem )) ;
-
- }
-
- break ;
- case WM_ERASEBACKGROUND:
- return MRFROMSHORT ( TRUE ) ;
- case WM_PAINT:
- {
- HPS hpsWnd ;
- HBITMAP hbmBitmap ;
- HWND hwndMenu ;
- POINTL ptl;
-
- ptl.x = 0;
- ptl.y = 0;
-
- hpsWnd = WinBeginPaint( hwndWnd, 0L, 0L );
- GpiErase( hpsWnd );
-
- hbmBitmap = GpiLoadBitmap ( hpsWnd,
- NULLHANDLE,
- IDB_BITMAP,
- 557,
- 353 ) ;
-
- WinDrawBitmap( hpsWnd, hbmBitmap, NULL, &ptl, CLR_NEUTRAL,
- CLR_BACKGROUND, DBM_NORMAL);
-
- GpiDeleteBitmap( hbmBitmap );
-
- WinEndPaint( hpsWnd );
- }
- break ;
-
- case WM_BUTTON1DOWN:
- case WM_BUTTON1DBLCLK:
- {
- CHAR szMsg[100];
-
- SHORT x, y;
-
- szMsg[0]= 0x00;
-
- x = MOUSEMSG(&ulMsg) -> x;
- y = MOUSEMSG(&ulMsg) -> y;
-
- if( ((x > 108) && (x < 119)) && ((y > 227) && (y < 239)) )
- {
- sprintf(szMsg,"Austin");
- if ( NoPaint_En <= 0 )
- {
- strcpy(En_temp,locale_temp);
- strcat(En_temp,"\\En_US.DLL");
-
- if ( access(En_temp,0) == -1 )
- WinMessageBox ( HWND_DESKTOP,
- hwndClient,
- "The locale path specified is invalid. Please use the Configure Menu to enter the correct locale path.",
- "Locale Path Error",
- 0,
- MB_NOICON | MB_OK ) ;
- else
- hwndUSA = WinLoadDlg(hwndClient,hwndWnd,
- USAProc,0L,IDDIALOG_USA,NULL);
- }
- }
- if( ((x > 253) && (x < 264)) && ((y > 246) && (y < 259)) )
- {
- sprintf(szMsg,"Madrid");
- if ( NoPaint_Es <= 0 )
- {
- strcpy(Es_temp,locale_temp);
- strcat(Es_temp,"\\Es_ES.DLL");
-
- if ( access(Es_temp,0) == -1 )
- WinMessageBox ( HWND_DESKTOP,
- hwndClient,
- "The locale path specified is invalid. Please use the Configure Menu to enter the correct locale path.",
- "Locale Path Error",
- 0,
- MB_NOICON | MB_OK ) ;
- else
- hwndSPAIN = WinLoadDlg(hwndClient,hwndWnd,
- SPAINProc,0L,IDDIALOG_SPAIN,NULL);
- }
- }
- if( ((x > 262) && (x < 275)) && ((y > 262) && (y < 275)) )
- {
- sprintf(szMsg,"Paris");
- if ( NoPaint_Fr <= 0 )
- {
- strcpy(Fr_temp,locale_temp);
- strcat(Fr_temp,"\\Fr_FR.DLL");
-
- if ( access(Fr_temp,0) == -1 )
- WinMessageBox ( HWND_DESKTOP,
- hwndClient,
- "The locale path specified is invalid. Please use the Configure Menu to enter the correct locale path.",
- "Locale Path Error",
- 0,
- MB_NOICON | MB_OK ) ;
- else
- hwndFRANCE = WinLoadDlg(hwndClient,hwndWnd,
- FRANCEProc,0L,IDDIALOG_FRANCE,NULL);
- }
- }
- if( ((x > 280) && (x < 290)) && ((y > 271) && (y < 282)) )
- {
- sprintf(szMsg,"Berlin");
- if ( NoPaint_De <= 0 )
- {
- strcpy(De_temp,locale_temp);
- strcat(De_temp,"\\De_DE.DLL");
-
- if ( access(De_temp,0) == -1 )
- WinMessageBox ( HWND_DESKTOP,
- hwndClient,
- "The locale path specified is invalid. Please use the Configure Menu to enter the correct locale path.",
- "Locale Path Error",
- 0,
- MB_NOICON | MB_OK ) ;
- else
- hwndGERMANY = WinLoadDlg(hwndClient,hwndWnd,
- GERMANYProc,0L,IDDIALOG_GERMANY,NULL);
- }
- }
- if( ((x > 287) && (x < 298)) && ((y > 284) && (y < 295)) )
- {
- sprintf(szMsg,"Stockholm");
- if ( NoPaint_Sv <= 0 )
- {
- strcpy(Sv_temp,locale_temp);
- strcat(Sv_temp,"\\Sv_SE.DLL");
-
- if ( access(Sv_temp,0) == -1 )
- WinMessageBox ( HWND_DESKTOP,
- hwndClient,
- "The locale path specified is invalid. Please use the Configure Menu to enter the correct locale path.",
- "Locale Path Error",
- 0,
- MB_NOICON | MB_OK ) ;
- else
- hwndSWEDEN = WinLoadDlg(hwndClient,hwndWnd,
- SWEDENProc,0L,IDDIALOG_SWEDEN,NULL);
- }
- }
- if( ((x > 475) && (x < 485)) && ((y > 235) && (y < 249)) )
- {
- sprintf(szMsg,"Tokyo");
- if ( NoPaint_Ja <= 0 )
- {
- strcpy(Ja_temp,locale_temp);
- strcat(Ja_temp,"\\Ja_JP.DLL");
-
- if ( access(Ja_temp,0) == -1 )
- WinMessageBox ( HWND_DESKTOP,
- hwndClient,
- "The locale path specified is invalid. Please use the Configure Menu to enter the correct locale path.",
- "Locale Path Error",
- 0,
- MB_NOICON | MB_OK ) ;
- else
- hwndJAPAN = WinLoadDlg(hwndClient,hwndWnd,
- JAPANProc,0L,IDDIALOG_JAPAN,NULL);
- }
- }
- if( szMsg[0] == 0x00)
- {
- sprintf(szMsg,"Please select a city.");
-
- WinMessageBox(HWND_DESKTOP,
- hwndWnd,
- szMsg,
- "Location",
- 0,
- MB_NOICON | MB_OK);
- }
- }
- break ;
-
- case WM_COMMAND:
-
- switch ( SHORT1FROMMP ( mpParm1 ))
- {
- case IDM_LOCALE:
- WinDlgBox(HWND_DESKTOP, hwndWnd, dialog_func, 0, D_TITLE, 0);
- break ;
-
- case IDM_HELP1:
- {
- HWND hwndFrame ;
- HWND hwndMenu ;
-
- hwndFrame = WinQueryWindow ( hwndWnd, QW_PARENT ) ;
- hwndMenu = WinWindowFromID ( hwndFrame, FID_MENU ) ;
- displayInfo ( hwndMenu,
- SHORT1FROMMP ( mpParm1 ) ,
- hwndWnd ) ;
- }
- break ;
-
- case IDM_INFO1:
- WinDlgBox(HWND_DESKTOP, hwndWnd, info_dialog_func, 0, TEST, 0);
- break ;
- case IDM_MONEY:
- WinQueryDlgItemText(hwnd, IDENTRY_MON, sizeof(Bucks),(PSZ)Bucks);
- num = atof(Bucks);
- break;
- default:
- return WinDefWindowProc ( hwndWnd,
- ulMsg,
- mpParm1,
- mpParm2 ) ;
- } /* endswitch */
- break ;
- default:
- return WinDefWindowProc ( hwndWnd,
- ulMsg,
- mpParm1,
- mpParm2 ) ;
- } /* endswitch */
-
- return MRFROMSHORT ( FALSE ) ;
- }
-
- VOID displayInfo ( HWND hwndMenu,
- USHORT usMenuItem,
- HWND hwndClient )
- {
- CHAR achText [2048] ;
-
- sprintf ( achText,"To load a country's locale use the mouse to select a city." );
-
- WinMessageBox ( HWND_DESKTOP,
- hwndClient,
- achText,
- "Running The Demo",
- 0,
- MB_NOICON | MB_OK ) ;
-
- return ;
- }
-
-
- MRESULT EXPENTRY dialog_func (HWND handle, ULONG mess, MPARAM parm1, MPARAM parm2)
- {
- static HWND hwnd;
-
-
- switch(mess)
- {
- case WM_INITDLG:
-
- WinEnableWindowUpdate(handle,FALSE);
- WinSetDlgItemText(handle,L_PATH,locale_temp);
- return(MRESULT)TRUE;
-
- case WM_CONTROL:
-
- return(MRESULT)TRUE;
-
-
- case WM_COMMAND:
-
- switch ( SHORT1FROMMP ( parm1 )) {
-
- case OK_BUTTON:
-
- WinQueryDlgItemText(handle, L_PATH, sizeof(locale_temp), (PSZ)locale_temp);
- WinDismissDlg ( handle, FALSE ) ;
- return WinDefDlgProc(handle, mess, parm1, parm2);
-
- default:
- return WinDefDlgProc (handle, mess, parm1, parm2);
-
- } /* endswitch */
- break ;
-
- default:
- return WinDefDlgProc(handle, mess, parm1, parm2);
- }
-
- return(MRESULT)0;
- }
-
- MRESULT EXPENTRY info_dialog_func (HWND handle, ULONG mess, MPARAM parm1, MPARAM parm2)
- {
- static HWND hwnd;
-
- switch(mess)
- {
- case WM_INITDLG:
-
- hwnd = WinWindowFromID(handle,(ULONG)TEST);
- WinEnableWindowUpdate(hwnd,FALSE);
- return(MRESULT)TRUE;
-
-
- case WM_CONTROL:
-
- return(MRESULT)TRUE;
-
- case WM_COMMAND:
-
- hwnd = WinWindowFromID(handle,(ULONG)TEST);
-
- switch ( SHORT1FROMMP ( parm1 )) {
-
- case INFO_OK:
- WinDismissDlg ( hwnd, FALSE ) ;
- return WinDefDlgProc (handle, mess, parm1, parm2);
-
- default:
- return WinDefDlgProc (handle, mess, parm1, parm2);
-
- } /* endswitch */
- break ;
-
- default:
- return WinDefDlgProc(handle, mess, parm1, parm2);
- }
-
- return(MRESULT)0;
- }
-
-
- VOID displayMenuInfo ( HWND hwndMenu,
- USHORT usMenuItem,
- HWND hwndClient )
- {
- USHORT usAllStyles ;
- USHORT usAttr ;
- USHORT usSzText ;
- CHAR achItemText [32] ;
- CHAR achText [128] ;
-
- usAllStyles = MIA_NODISMISS | MIA_FRAMED | MIA_CHECKED |
- MIA_DISABLED | MIA_HILITED ;
-
- usAttr = SHORT1FROMMR ( WinSendMsg ( hwndMenu,
- MM_QUERYITEMATTR,
- MPFROM2SHORT ( usMenuItem, TRUE ) ,
- MPFROMSHORT ( usAllStyles )) ) ;
-
- usSzText = SHORT1FROMMR ( WinSendMsg ( hwndMenu,
- MM_QUERYITEMTEXT,
- MPFROM2SHORT ( usMenuItem, 30 ) ,
- MPFROMP ( achItemText )) ) ;
-
- sprintf ( achText,
- "Menu Item: \"%s\"\nMenu Item Styles are: 0x%04x",
- usSzText ? achItemText : " (null) ",
- usAttr ) ;
-
- WinMessageBox ( HWND_DESKTOP,
- hwndClient,
- achText,
- "Menu Information",
- 0,
- MB_OK ) ;
-
- return ;
- }
- /* ********************************************************************** */
- MRESULT EXPENTRY USAProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
- {
- static char *p;
- static char buf[len_array];
- static char T1[255], T2[255];
- static double Num;
- int i, j,
- count,
- result,
- temp_j;
-
- const char *temp1,
- *temp2;
-
- char temp;
-
- IPT Offset;
- ULONG BytesToMLE;
-
-
- switch(msg)
- {
-
- case WM_INITDLG:
- {
- NoPaint_En++;
- WinSendDlgItemMsg( hwnd,
- ID_COLL_USA,
- MLM_SETIMPORTEXPORT,
- MPFROMP ( buf ),
- MPFROMSHORT ( (USHORT) sizeof (buf ))
- );
-
- WinSendDlgItemMsg( hwnd,
- ID_COLL_USA,
- MLM_FORMAT,
- (MPARAM)MLFIE_NOTRANS,
- NULL
- );
- {
- char temp99[256];
- sprintf(temp99,setlocale(LC_ALL, En_temp));
- /*WinMessageBox(HWND_DESKTOP,hwndClient,temp99,
- "Calling 'setlocale'",0,MB_INFORMATION | MB_OK);*/
- }
-
- i = 0;
- p = "lion \0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
- i+=width;
-
- p = "crow \0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
- i+=width;
-
- p = "chimp\0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
- i+=width;
-
- p = "loon \0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
- i+=width;
-
- p = "llama\0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
- i+=width;
-
- p = "camel\0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
-
- BytesToMLE = sizeof(buf);
- for (j =0; j <= BytesToMLE; j++)
- if ( buf [ j ] == '\0' ) buf [ j ] = '\n';
-
- Offset = 0;
- WinSendDlgItemMsg(hwnd,ID_COLL_USA, MLM_IMPORT,
- MPFROMP (&Offset),MPFROMP (&BytesToMLE));
-
- time(<ime);
- ptmT = localtime(<ime);
- Num = num;
- strftime(T2,18,"%x",ptmT);
- WinSetDlgItemText(hwnd,ID_DATE_USA,T2);
- strftime(T2,18,"%X",ptmT);
- WinSetDlgItemText(hwnd,ID_TIME_USA,T2);
- strfmon(T1,20,"%n",Num);
- WinSetDlgItemText(hwnd,ID_MON_USA,T1);
-
- }
- break;
-
-
-
- case WM_COMMAND:
-
- switch(SHORT1FROMMP(mp1))
- {
-
- case ID_COLLATE_USA :
- setlocale(LC_ALL, En_temp);
- BytesToMLE = sizeof(buf);
- for (j =0; j <= BytesToMLE; j++)
- if ( buf [ j ] == '\n' ) buf [ j ] = '\0';
-
- Offset = 0;
- WinSendDlgItemMsg(hwnd,ID_COLL_USA, MLM_EXPORT,
- MPFROMP (&Offset),MPFROMP (&BytesToMLE));
- Offset = 0;
- BytesToMLE = sizeof(buf);
- WinSendDlgItemMsg(hwnd,ID_COLL_USA, MLM_DELETE,
- MPFROMLONG (0),MPFROMLONG (BytesToMLE));
-
- for (i=0;i<len_array;i+=width)
- {
- j=i+width;
- while(j < len_array)
- {
- temp1 = &buf[i];
- temp2 = &buf[j];
- result = strcoll(temp1, temp2);
- if (result > 0)
- {
- temp_j = j;
- for (count=i;count<width+i;count++)
- {
- temp = buf[count];
- buf[count] = buf[temp_j];
- buf[temp_j] = temp;
- temp_j++;
- }
- }
- j+=width;
- }
- }
-
- BytesToMLE = sizeof(buf);
- for (j =0; j <= BytesToMLE; j++)
- if ( buf [ j ] == '\0' ) buf [ j ] = '\n';
-
- Offset = 0;
- WinSendDlgItemMsg(hwnd,ID_COLL_USA, MLM_IMPORT,
- MPFROMP (&Offset),MPFROMP (&BytesToMLE));
-
- break;
-
-
- case ID_CANCEL_USA: /* The Cancel pushbutton or Escape key */
- WinPostMsg( hwndUSA, WM_CLOSE, NULL, NULL);
- NoPaint_En--;
- break;
-
- default :
- break;
- }
- break;
-
- case WM_SIZE:
- WinSetWindowPos( hwndUSA,HWND_TOP,
- 5,10,SHORT1FROMMP(mp2),SHORT2FROMMP(mp2),
- SWP_MOVE | SWP_SIZE | SWP_SHOW);
- break;
-
- case WM_ERASEBACKGROUND:
- return (MRESULT) 1;
-
- case WM_HELP:
- /*DisplayHelpPanel(SHORT1FROMMP(mp1));*/
- break;
-
- default:
- return(WinDefDlgProc(hwnd, msg, mp1, mp2));
- } /* end switch */
-
- return (MRESULT)0;
-
- } /* end USAProc */
- /* ********************************************************************** */
- MRESULT EXPENTRY SPAINProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
- {
- static char *p;
- static char buf[len_array];
- static char T1[255], T2[255];
- static double Num;
- int i, j,
- count,
- result,
- temp_j;
-
- const char *temp1,
- *temp2;
-
- char temp;
-
- IPT Offset;
- ULONG BytesToMLE;
-
-
- switch(msg)
- {
-
- case WM_INITDLG:
- {
-
- NoPaint_Es++;
- WinSendDlgItemMsg( hwnd,
- ID_COLL_SPAIN,
- MLM_SETIMPORTEXPORT,
- MPFROMP ( buf ),
- MPFROMSHORT ( (USHORT) sizeof (buf ))
- );
-
- WinSendDlgItemMsg( hwnd,
- ID_COLL_SPAIN,
- MLM_FORMAT,
- (MPARAM)MLFIE_NOTRANS,
- NULL
- );
-
- setlocale(LC_ALL, Es_temp);
-
- i = 0;
- p = "lion \0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
- i+=width;
-
- p = "chimp\0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
- i+=width;
-
- p = "conch\0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
- i+=width;
-
- p = "camel\0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
- i+=width;
-
- p = "llama\0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
- i+=width;
-
- p = "loon \0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
-
- BytesToMLE = sizeof(buf);
- for (j =0; j <= BytesToMLE; j++)
- if ( buf [ j ] == '\0' ) buf [ j ] = '\n';
-
- Offset = 0;
- WinSendDlgItemMsg(hwnd,ID_COLL_SPAIN, MLM_IMPORT,
- MPFROMP (&Offset),MPFROMP (&BytesToMLE));
-
- time(<ime);
- ptmT = localtime(<ime);
- Num = num * 139.65;
- strftime(T2,18,"%x",ptmT);
- WinSetDlgItemText(hwnd,ID_DATE_SPAIN,T2);
- strftime(T2,18,"%X",ptmT);
- WinSetDlgItemText(hwnd,ID_TIME_SPAIN,T2);
- strfmon(T1,20,"%n",Num);
- WinSetDlgItemText(hwnd,ID_MON_SPAIN,T1);
-
-
- }
- break;
-
-
-
- case WM_COMMAND:
-
- switch(SHORT1FROMMP(mp1))
- {
-
- case ID_COLLATE_SPAIN :
- setlocale(LC_ALL, Es_temp);
- BytesToMLE = sizeof(buf);
- for (j =0; j <= BytesToMLE; j++)
- if ( buf [ j ] == '\n' ) buf [ j ] = '\0';
-
- Offset = 0;
- WinSendDlgItemMsg(hwnd,ID_COLL_SPAIN, MLM_EXPORT,
- MPFROMP (&Offset),MPFROMP (&BytesToMLE));
- Offset = 0;
- BytesToMLE = sizeof(buf);
- WinSendDlgItemMsg(hwnd,ID_COLL_SPAIN, MLM_DELETE,
- MPFROMLONG (0),MPFROMLONG (BytesToMLE));
-
- for (i=0;i<len_array;i+=width)
- {
- j=i+width;
- while(j < len_array)
- {
- temp1 = &buf[i];
- temp2 = &buf[j];
- result = strcoll(temp1, temp2);
- if (result > 0)
- {
- temp_j = j;
- for (count=i;count<width+i;count++)
- {
- temp = buf[count];
- buf[count] = buf[temp_j];
- buf[temp_j] = temp;
- temp_j++;
- }
- }
- j+=width;
- }
- }
-
- BytesToMLE = sizeof(buf);
- for (j =0; j <= BytesToMLE; j++)
- if ( buf [ j ] == '\0' ) buf [ j ] = '\n';
-
- Offset = 0;
- WinSendDlgItemMsg(hwnd,ID_COLL_SPAIN, MLM_IMPORT,
- MPFROMP (&Offset),MPFROMP (&BytesToMLE));
-
- break;
-
-
- case ID_CANCEL_SPAIN: /* The Cancel pushbutton or Escape key */
- WinPostMsg( hwndSPAIN, WM_CLOSE, NULL, NULL);
- NoPaint_Es--;
- break;
-
- default :
- break;
- }
- break;
-
- case WM_SIZE:
- WinSetWindowPos( hwndSPAIN,HWND_TOP,
- 120,5,SHORT1FROMMP(mp2),SHORT2FROMMP(mp2),
- SWP_SHOW);
- break;
-
- case WM_ERASEBACKGROUND:
- return (MRESULT) 1;
-
- case WM_HELP:
- /*DisplayHelpPanel(SHORT1FROMMP(mp1));*/
- break;
-
- default:
- return(WinDefDlgProc(hwnd, msg, mp1, mp2));
- } /* end switch */
-
- return (MRESULT)0;
-
- } /* end SPAINProc */
-
- /* ********************************************************************** */
- MRESULT EXPENTRY FRANCEProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
- {
- static char *p;
- static char buf[len_array];
- static char T1[255], T2[255];
- static double Num;
- int i, j,
- count,
- result,
- temp_j;
-
- const char *temp1,
- *temp2;
-
- char temp;
-
- IPT Offset;
- ULONG BytesToMLE;
-
-
- switch(msg)
- {
-
- case WM_INITDLG:
- {
- NoPaint_Fr++;
- WinSendDlgItemMsg( hwnd,
- ID_COLL_FRANCE,
- MLM_SETIMPORTEXPORT,
- MPFROMP ( buf ),
- MPFROMSHORT ( (USHORT) sizeof (buf ))
- );
-
- WinSendDlgItemMsg( hwnd,
- ID_COLL_FRANCE,
- MLM_FORMAT,
- (MPARAM)MLFIE_NOTRANS,
- NULL
- );
- setlocale(LC_ALL, Fr_temp);
-
- i = 0;
- p = "lion \0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
- i+=width;
-
- p = "chimp\0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
- i+=width;
-
- p = "conch\0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
- i+=width;
-
- p = "loon \0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
- i+=width;
-
- p = "llama\0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
- i+=width;
-
- p = "camel\0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
-
- BytesToMLE = sizeof(buf);
- for (j =0; j <= BytesToMLE; j++)
- if ( buf [ j ] == '\0' ) buf [ j ] = '\n';
-
- Offset = 0;
-
- WinSendDlgItemMsg(hwnd,ID_COLL_FRANCE, MLM_IMPORT,
- MPFROMP (&Offset),MPFROMP (&BytesToMLE));
-
- time(<ime);
- ptmT = localtime(<ime);
- Num = num * 5.885;
- strftime(T2,18,"%x",ptmT);
- WinSetDlgItemText(hwnd,ID_DATE_FRANCE,T2);
- strftime(T2,18,"%X",ptmT);
- WinSetDlgItemText(hwnd,ID_TIME_FRANCE,T2);
- strfmon(T1,20,"%n",Num);
- WinSetDlgItemText(hwnd,ID_MON_FRANCE,T1);
-
-
- }
- break;
-
-
-
- case WM_COMMAND:
-
- switch(SHORT1FROMMP(mp1))
- {
-
- case ID_COLLATE_FRANCE :
- setlocale(LC_ALL, Fr_temp);
-
- BytesToMLE = sizeof(buf);
- for (j =0; j <= BytesToMLE; j++)
- if ( buf [ j ] == '\n' ) buf [ j ] = '\0';
-
- Offset = 0;
- WinSendDlgItemMsg(hwnd,ID_COLL_FRANCE, MLM_EXPORT,
- MPFROMP (&Offset),MPFROMP (&BytesToMLE));
- Offset = 0;
- BytesToMLE = sizeof(buf);
- WinSendDlgItemMsg(hwnd,ID_COLL_FRANCE, MLM_DELETE,
- MPFROMLONG (0),MPFROMLONG (BytesToMLE));
-
- for (i=0;i<len_array;i+=width)
- {
- j=i+width;
- while(j < len_array)
- {
- temp1 = &buf[i];
- temp2 = &buf[j];
- result = strcoll(temp1, temp2);
- if (result > 0)
- {
- temp_j = j;
- for (count=i;count<width+i;count++)
- {
- temp = buf[count];
- buf[count] = buf[temp_j];
- buf[temp_j] = temp;
- temp_j++;
- }
- }
- j+=width;
- }
- }
-
- BytesToMLE = sizeof(buf);
- for (j =0; j <= BytesToMLE; j++)
- if ( buf [ j ] == '\0' ) buf [ j ] = '\n';
-
- Offset = 0;
- WinSendDlgItemMsg(hwnd,ID_COLL_FRANCE, MLM_IMPORT,
- MPFROMP (&Offset),MPFROMP (&BytesToMLE));
-
- break;
-
-
- case ID_CANCEL_FRANCE: /* The Cancel pushbutton or Escape key */
- WinPostMsg( hwndFRANCE, WM_CLOSE, NULL, NULL);
- NoPaint_Fr--;
- break;
-
- default :
- break;
- }
- break;
-
- case WM_SIZE:
- WinSetWindowPos( hwndFRANCE,HWND_TOP,
- 250,10,SHORT1FROMMP(mp2),SHORT2FROMMP(mp2),
- SWP_SHOW);
- break;
-
- case WM_ERASEBACKGROUND:
- return (MRESULT) 1;
-
- case WM_HELP:
- /*DisplayHelpPanel(SHORT1FROMMP(mp1));*/
- break;
-
- default:
- return(WinDefDlgProc(hwnd, msg, mp1, mp2));
- } /* end switch */
-
- return (MRESULT)0;
-
- } /* end FRANCEProc */
- /* ********************************************************************** */
- MRESULT EXPENTRY GERMANYProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
- {
- static char *p;
- static char buf[len_array];
- static char T1[255], T2[255];
- static double Num;
- int i, j,
- count,
- result,
- temp_j;
-
- const char *temp1,
- *temp2;
-
- char temp;
-
- IPT Offset;
- ULONG BytesToMLE;
-
- switch(msg)
- {
-
- case WM_INITDLG:
- {
- NoPaint_De++;
- WinSendDlgItemMsg( hwnd,
- ID_COLL_GERMANY,
- MLM_SETIMPORTEXPORT,
- MPFROMP ( buf ),
- MPFROMSHORT ( (USHORT) sizeof (buf ))
- );
-
- WinSendDlgItemMsg( hwnd,
- ID_COLL_GERMANY,
- MLM_FORMAT,
- (MPARAM)MLFIE_NOTRANS,
- NULL
- );
- setlocale(LC_ALL, De_temp);
-
- i = 0;
- p = "conch\0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
- i+=width;
-
- p = "chimp\0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
- i+=width;
-
- p = "lynx \0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
- i+=width;
-
- p = "lion \0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
- i+=width;
-
- p = "llama\0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
- i+=width;
-
- p = "camel\0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
-
- BytesToMLE = sizeof(buf);
- for (j =0; j <= BytesToMLE; j++)
- if ( buf [ j ] == '\0' ) buf [ j ] = '\n';
-
- Offset = 0;
-
- WinSendDlgItemMsg(hwnd,ID_COLL_GERMANY, MLM_IMPORT,
- MPFROMP (&Offset),MPFROMP (&BytesToMLE));
-
- time(<ime);
- ptmT = localtime(<ime);
- Num = num * 1.740;
- strftime(T2,18,"%x",ptmT);
- WinSetDlgItemText(hwnd,ID_DATE_GERMANY,T2);
- strftime(T2,18,"%X",ptmT);
- WinSetDlgItemText(hwnd,ID_TIME_GERMANY,T2);
- strfmon(T1,20,"%n",Num);
- WinSetDlgItemText(hwnd,ID_MON_GERMANY,T1);
-
- }
- break;
-
-
-
- case WM_COMMAND:
-
- switch(SHORT1FROMMP(mp1))
- {
-
- case ID_COLLATE_GERMANY :
- setlocale(LC_ALL, De_temp);
- BytesToMLE = sizeof(buf);
- for (j =0; j <= BytesToMLE; j++)
- if ( buf [ j ] == '\n' ) buf [ j ] = '\0';
-
- Offset = 0;
- WinSendDlgItemMsg(hwnd,ID_COLL_GERMANY, MLM_EXPORT,
- MPFROMP (&Offset),MPFROMP (&BytesToMLE));
- Offset = 0;
- BytesToMLE = sizeof(buf);
- WinSendDlgItemMsg(hwnd,ID_COLL_GERMANY, MLM_DELETE,
- MPFROMLONG (0),MPFROMLONG (BytesToMLE));
-
- for (i=0;i<len_array;i+=width)
- {
- j=i+width;
- while(j < len_array)
- {
- temp1 = &buf[i];
- temp2 = &buf[j];
- result = strcoll(temp1, temp2);
- if (result > 0)
- {
- temp_j = j;
- for (count=i;count<width+i;count++)
- {
- temp = buf[count];
- buf[count] = buf[temp_j];
- buf[temp_j] = temp;
- temp_j++;
- }
- }
- j+=width;
- }
- }
-
- BytesToMLE = sizeof(buf);
- for (j =0; j <= BytesToMLE; j++)
- if ( buf [ j ] == '\0' ) buf [ j ] = '\n';
-
- Offset = 0;
- WinSendDlgItemMsg(hwnd,ID_COLL_GERMANY, MLM_IMPORT,
- MPFROMP (&Offset),MPFROMP (&BytesToMLE));
-
- break;
-
-
- case ID_CANCEL_GERMANY: /* The Cancel pushbutton or Escape key */
- WinPostMsg( hwndGERMANY, WM_CLOSE, NULL, NULL);
- NoPaint_De--;
- break;
-
- default :
- break;
- }
- break;
-
- case WM_SIZE:
- WinSetWindowPos( hwndGERMANY,HWND_TOP,
- 5,10,SHORT1FROMMP(mp2),SHORT2FROMMP(mp2),
- SWP_MOVE | SWP_SIZE | SWP_SHOW);
- break;
-
- case WM_ERASEBACKGROUND:
- return (MRESULT) 1;
-
- case WM_HELP:
- /*DisplayHelpPanel(SHORT1FROMMP(mp1));*/
- break;
-
- default:
- return(WinDefDlgProc(hwnd, msg, mp1, mp2));
- } /* end switch */
-
- return (MRESULT)0;
-
- } /* end GERMANYProc */
- /* ********************************************************************** */
- MRESULT EXPENTRY JAPANProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
- {
- static char *p;
- static char buf[len_array];
- static char T1[255], T2[255];
- static double Num;
- int i, j,
- count,
- result,
- temp_j;
-
- const char *temp1,
- *temp2;
-
- char temp;
-
- IPT Offset;
- ULONG BytesToMLE;
-
- switch(msg)
- {
-
- case WM_INITDLG:
- {
- NoPaint_Ja++;
- WinSendDlgItemMsg( hwnd,
- ID_COLL_JAPAN,
- MLM_SETIMPORTEXPORT,
- MPFROMP ( buf ),
- MPFROMSHORT ( (USHORT) sizeof (buf ))
- );
-
- WinSendDlgItemMsg( hwnd,
- ID_COLL_JAPAN,
- MLM_FORMAT,
- (MPARAM)MLFIE_NOTRANS,
- NULL
- );
- setlocale(LC_ALL, Ja_temp);
-
- i = 0;
- p = "lion \0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
- i+=width;
-
- p = "chimp\0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
- i+=width;
-
- p = "loon \0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
- i+=width;
-
- p = "camel\0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
- i+=width;
-
- p = "llama\0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
- i+=width;
-
- p = "conch\0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
-
- BytesToMLE = sizeof(buf);
- for (j =0; j <= BytesToMLE; j++)
- if ( buf [ j ] == '\0' ) buf [ j ] = '\n';
-
- Offset = 0;
-
- WinSendDlgItemMsg(hwnd,ID_COLL_JAPAN, MLM_IMPORT,
- MPFROMP (&Offset),MPFROMP (&BytesToMLE));
-
- time(<ime);
- ptmT = localtime(<ime);
- Num = num * 108.65;
- strftime(T2,20,"%x",ptmT);
- WinSetDlgItemText(hwnd,ID_DATE_JAPAN,T2);
- strftime(T2,20,"%X",ptmT);
- WinSetDlgItemText(hwnd,ID_TIME_JAPAN,T2);
- strfmon(T1,20,"%n",Num);
- WinSetDlgItemText(hwnd,ID_MON_JAPAN,T1);
-
- }
- break;
-
-
-
- case WM_COMMAND:
-
- switch(SHORT1FROMMP(mp1))
- {
-
- case ID_COLLATE_JAPAN :
-
- setlocale(LC_ALL, Ja_temp);
-
- BytesToMLE = sizeof(buf);
- for (j =0; j <= BytesToMLE; j++)
- if ( buf [ j ] == '\n' ) buf [ j ] = '\0';
-
- Offset = 0;
- WinSendDlgItemMsg(hwnd,ID_COLL_JAPAN, MLM_EXPORT,
- MPFROMP (&Offset),MPFROMP (&BytesToMLE));
- Offset = 0;
- BytesToMLE = sizeof(buf);
- WinSendDlgItemMsg(hwnd,ID_COLL_JAPAN, MLM_DELETE,
- MPFROMLONG (0),MPFROMLONG (BytesToMLE));
-
- for (i=0;i<len_array;i+=width)
- {
- j=i+width;
- while(j < len_array)
- {
- temp1 = &buf[i];
- temp2 = &buf[j];
- result = strcoll(temp1, temp2);
- if (result > 0)
- {
- temp_j = j;
- for (count=i;count<width+i;count++)
- {
- temp = buf[count];
- buf[count] = buf[temp_j];
- buf[temp_j] = temp;
- temp_j++;
- }
- }
- j+=width;
- }
- }
-
- BytesToMLE = sizeof(buf);
- for (j =0; j <= BytesToMLE; j++)
- if ( buf [ j ] == '\0' ) buf [ j ] = '\n';
-
- Offset = 0;
- WinSendDlgItemMsg(hwnd,ID_COLL_JAPAN, MLM_IMPORT,
- MPFROMP (&Offset),MPFROMP (&BytesToMLE));
-
- break;
-
-
- case ID_CANCEL_JAPAN: /* The Cancel pushbutton or Escape key */
- WinPostMsg( hwndJAPAN, WM_CLOSE, NULL, NULL);
- NoPaint_Ja--;
- break;
-
- default :
- break;
- }
- break;
-
- case WM_SIZE:
- WinSetWindowPos( hwndJAPAN,HWND_TOP,
- 5,10,SHORT1FROMMP(mp2),SHORT2FROMMP(mp2),
- SWP_MOVE | SWP_SIZE | SWP_SHOW);
- break;
-
- case WM_ERASEBACKGROUND:
- return (MRESULT) 1;
-
- case WM_HELP:
- /*DisplayHelpPanel(SHORT1FROMMP(mp1));*/
- break;
-
- default:
- return(WinDefDlgProc(hwnd, msg, mp1, mp2));
- } /* end switch */
-
- return (MRESULT)0;
-
- } /* end JAPANProc */
-
- /* ********************************************************************** */
- MRESULT EXPENTRY SWEDENProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
- {
- static char *p;
- static char buf[len_array];
- static char T1[255], T2[255];
- static double Num;
- int i, j,
- count,
- result,
- temp_j;
-
- const char *temp1,
- *temp2;
-
- char temp;
-
- IPT Offset;
- ULONG BytesToMLE;
-
- switch(msg)
- {
-
- case WM_INITDLG:
- {
- NoPaint_Sv++;
- WinSendDlgItemMsg( hwnd,
- ID_COLL_SWEDEN,
- MLM_SETIMPORTEXPORT,
- MPFROMP ( buf ),
- MPFROMSHORT ( (USHORT) sizeof (buf ))
- );
-
- WinSendDlgItemMsg( hwnd,
- ID_COLL_SWEDEN,
- MLM_FORMAT,
- (MPARAM)MLFIE_NOTRANS,
- NULL
- );
- setlocale(LC_ALL, Sv_temp);
-
- i = 0;
- p = "lion \0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
- i+=width;
-
- p = "chimp\0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
- i+=width;
-
- p = "conch\0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
- i+=width;
-
- p = "loon \0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
- i+=width;
-
- p = "llama\0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
- i+=width;
-
- p = "camel\0";
- for (count=i;count<(width+i);count++)
- buf[count]= *p++;
-
- BytesToMLE = sizeof(buf);
- for (j =0; j <= BytesToMLE; j++)
- if ( buf [ j ] == '\0' ) buf [ j ] = '\n';
-
- Offset = 0;
-
- WinSendDlgItemMsg(hwnd,ID_COLL_SWEDEN, MLM_IMPORT,
- MPFROMP (&Offset),MPFROMP (&BytesToMLE));
-
- time(<ime);
- ptmT = localtime(<ime);
- Num = num * 7.908;
- strftime(T2,10,"%x",ptmT);
- WinSetDlgItemText(hwnd,ID_DATE_SWEDEN,T2);
- strftime(T2,10,"%X",ptmT);
- WinSetDlgItemText(hwnd,ID_TIME_SWEDEN,T2);
- strfmon(T1,20,"%n",Num);
- WinSetDlgItemText(hwnd,ID_MON_SWEDEN,T1);
-
-
- }
- break;
-
-
-
- case WM_COMMAND:
-
- switch(SHORT1FROMMP(mp1))
- {
-
- case ID_COLLATE_SWEDEN :
- setlocale(LC_ALL, Sv_temp);
- BytesToMLE = sizeof(buf);
- for (j =0; j <= BytesToMLE; j++)
- if ( buf [ j ] == '\n' ) buf [ j ] = '\0';
-
- Offset = 0;
- WinSendDlgItemMsg(hwnd,ID_COLL_SWEDEN, MLM_EXPORT,
- MPFROMP (&Offset),MPFROMP (&BytesToMLE));
- Offset = 0;
- BytesToMLE = sizeof(buf);
- WinSendDlgItemMsg(hwnd,ID_COLL_SWEDEN, MLM_DELETE,
- MPFROMLONG (0),MPFROMLONG (BytesToMLE));
-
- for (i=0;i<len_array;i+=width)
- {
- j=i+width;
- while(j < len_array)
- {
- temp1 = &buf[i];
- temp2 = &buf[j];
- result = strcoll(temp1, temp2);
- if (result > 0)
- {
- temp_j = j;
- for (count=i;count<width+i;count++)
- {
- temp = buf[count];
- buf[count] = buf[temp_j];
- buf[temp_j] = temp;
- temp_j++;
- }
- }
- j+=width;
- }
- }
-
- BytesToMLE = sizeof(buf);
- for (j =0; j <= BytesToMLE; j++)
- if ( buf [ j ] == '\0' ) buf [ j ] = '\n';
-
- Offset = 0;
- WinSendDlgItemMsg(hwnd,ID_COLL_SWEDEN, MLM_IMPORT,
- MPFROMP (&Offset),MPFROMP (&BytesToMLE));
-
- break;
-
-
- case ID_CANCEL_SWEDEN: /* The Cancel pushbutton or Escape key */
- WinPostMsg( hwndSWEDEN, WM_CLOSE, NULL, NULL);
- NoPaint_Sv--;
- break;
-
- default :
- break;
- }
- break;
-
- case WM_SIZE:
- WinSetWindowPos( hwndSWEDEN,HWND_TOP,
- 5,10,SHORT1FROMMP(mp2),SHORT2FROMMP(mp2),
- SWP_MOVE | SWP_SIZE | SWP_SHOW);
- break;
-
- case WM_ERASEBACKGROUND:
- return (MRESULT) 1;
-
- case WM_HELP:
- /*DisplayHelpPanel(SHORT1FROMMP(mp1));*/
- break;
-
- default:
- return(WinDefDlgProc(hwnd, msg, mp1, mp2));
- } /* end switch */
-
- return (MRESULT)0;
-
- } /* end SWEDENProc */
-
-