home *** CD-ROM | disk | FTP | other *** search
/ Enter 1999 April - Disc 1 / enter_04_1999_1.iso / OS2 / OSMULTI / ABOUT.C next >
Encoding:
C/C++ Source or Header  |  1999-02-01  |  2.6 KB  |  118 lines

  1. /*
  2.  * about.c - about dialog
  3.  */
  4.  
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7.  
  8. #define INCL_PM
  9. #include <os2.h>
  10.  
  11. #include "osmulti2.h"
  12. #include "osmulres.h"
  13.  
  14. /*
  15.  * loadDesc - load description
  16.  */
  17.  
  18. void    loadDesc(HWND hwndDlg)
  19. {
  20.     HWND    hwnd = WinWindowFromID(hwndDlg, IDD_ADESC) ;
  21.     APIRET  stat ;
  22.     ULONG   idRes ;
  23.     PVOID   pRes  ;
  24.     PUCHAR  pDsc, pDst ;
  25.     ULONG   len ;
  26.     IPT     off ;
  27.     UCHAR   error[64]  ;
  28.     UCHAR   about[128] ;
  29.     
  30.     WinSendMsg(hwnd, MLM_DISABLEREFRESH, NULL, NULL) ;
  31.  
  32.     WinSendMsg(hwnd, MLM_FORMAT, MPFROMSHORT(MLFIE_CFTEXT), NULL) ;
  33.     WinSendMsg(hwnd, MLM_SETTABSTOP, MPFROMSHORT(20), NULL) ;
  34.   
  35.     WinSendMsg(hwnd, MLM_SETIMPORTEXPORT, MPFROMP(about), MPFROMSHORT(128)) ;
  36.     
  37.     switch (ProgramLang) {
  38.         case NLS_JA : idRes = IDD_ATXT_JP ; break ;
  39.     case NLS_EN : idRes = IDD_ATXT_EN ; break ;
  40.     default     : idRes = IDD_ATXT_EN ; break ;
  41.     }
  42.  
  43.     if ((stat = DosGetResource(NULLHANDLE, IDD_ATYPE, idRes, &pRes)) != 0) {
  44.         sprintf(about, "Error %d\n", stat) ;
  45.     pDsc = error ;
  46.     } else {
  47.         pDsc = (PUCHAR) pRes ;
  48.     }
  49.  
  50.     pDst = about, len = 0, off = 0 ;
  51.  
  52.     while (*pDsc != '\0') {
  53.         if (len == 128) {
  54.         len = (ULONG) WinSendMsg(hwnd, 
  55.                     MLM_IMPORT, MPFROMP(&off), MPFROMLONG(len)) ;
  56.             off += len ;
  57.             pDst = about, len = 0 ;
  58.     }
  59.     *pDst++ = *pDsc++ ;
  60.     len += 1 ;
  61.     }
  62.     if (len > 0) {
  63.         WinSendMsg(hwnd, MLM_IMPORT, MPFROMP(&off), MPFROMLONG(len)) ;
  64.     }
  65.     
  66.     DosFreeResource(pRes) ;
  67.  
  68.     WinSendMsg(hwnd, MLM_ENABLEREFRESH, NULL, NULL) ;
  69. }
  70.  
  71. /*
  72.  * procAbout - dialog procedure for about dialog
  73.  */
  74.  
  75. static MRESULT EXPENTRY procAbout(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
  76. {
  77.     switch (msg) {
  78.  
  79.     case WM_INITDLG :
  80.         dialogAtMouse(hwnd) ;
  81.     loadDesc(hwnd) ;
  82.         return (MRESULT) 0 ;
  83.  
  84.     case WM_COMMAND :
  85.         switch (SHORT1FROMMP(mp1)) {
  86.     case DID_OK :
  87.         WinDismissDlg(hwnd, DID_OK) ;
  88.         return (MRESULT) 0 ;
  89.         case DID_CANCEL :
  90.         WinDismissDlg(hwnd, DID_CANCEL) ;
  91.         return (MRESULT) 0 ;    
  92.         default :
  93.         return (MRESULT) 0 ;
  94.     }
  95.     }
  96.     return WinDefDlgProc(hwnd, msg, mp1, mp2) ;
  97. }
  98.  
  99. /*
  100.  * aboutDialog - entry of about dialog
  101.  */
  102.  
  103. void    aboutDialog(void)
  104. {
  105.     ULONG   idAbout ;
  106.     
  107.     switch (ProgramLang) {
  108.         case NLS_JA : idAbout = IDD_ABOUT  ; break ;
  109.     case NLS_EN : idAbout = IDD_ABOUTE ; break ;
  110.     default     : idAbout = IDD_ABOUTE ; break ;
  111.     }
  112.     
  113.     WinDlgBox(HWND_DESKTOP, NULLHANDLE, 
  114.                 procAbout, NULLHANDLE, idAbout, NULL) ;
  115. }
  116.  
  117.  
  118.