home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mnth0107.zip / Anderson / listings / edlg.cls < prev    next >
Text File  |  1992-02-27  |  25KB  |  508 lines

  1.             Listing for edlg.c                                          Page 21
  2.  
  3.           928|   #define INCL_WINHELP
  4.           929|   #define INCL_WIN
  5.           930|   #define INCL_GPI
  6.           931|   #define INCL_DOS
  7.           932|   #include <os2.h>
  8.           933|   #include <stdio.h>
  9.           934|   #include <string.h>
  10.           935|   #include <stdlib.h>
  11.           936|   #include "edit.h"
  12.           937|   #include "edlg.h"
  13.           938|   
  14.           939|   /* window procedure for about box */
  15.           940|   MRESULT EXPENTRY AboutDlgProc (HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2)
  16.           941|   {
  17.           942|      switch (msg) {
  18.           943|         case WM_COMMAND:
  19.           944|            switch (SHORT1FROMMP (mp1)) {
  20.           945|               case DID_OK:
  21.           946|               case DID_CANCEL:
  22.           947|                  WinDismissDlg (hwnd, TRUE);
  23.           948|                  return 0;
  24.           949|               default:
  25.           950|                  break;
  26.           951|            }
  27.           952|      }
  28.           953|      return WinDefDlgProc (hwnd, msg, mp1, mp2);
  29.           954|   }
  30.           955|   
  31.           956|   
  32.           957|   /* fill directory box with subdirectory names */
  33.           958|   /* by Charles Petzold, from Programming the OS/2 Presentation Manager */
  34.           959|   VOID FillDirListBox (HWND hwnd, CHAR *pcCurrentPath)
  35.           960|   {
  36.           961|      static CHAR szDrive[] = "  :";
  37.           962|      FILEFINDBUF findbuf;
  38.           963|      HDIR hDir = 1;
  39.           964|      SHORT sDrive;
  40.           965|      USHORT usDriveNum, usCurPathLen, usSearchCount = 1;
  41.           966|      ULONG ulDriveMap;
  42.           967|   
  43.           968|      DosQCurDisk (&usDriveNum, &ulDriveMap);
  44.           969|      pcCurrentPath[0] = (CHAR)((CHAR) usDriveNum + '@');
  45.           970|      pcCurrentPath[1] = ':';
  46.           971|      pcCurrentPath[2] = '\\';
  47.           972|      usCurPathLen = 64;
  48.           973|      DosQCurDir (0, pcCurrentPath + 3, &usCurPathLen);
  49.           974|   
  50.           975|      WinSetDlgItemText (hwnd, DID_PATH, pcCurrentPath);
  51.           976|      WinSendDlgItemMsg (hwnd, DID_DIRLIST, LM_DELETEALL, NULL, NULL);
  52.           977|   
  53.           978|      for (sDrive = 0 ; sDrive < 26 ; sDrive++) {
  54.           979|         if (ulDriveMap & 1L << sDrive) {
  55.           980|            szDrive[1] = (CHAR)((CHAR) sDrive + 'A');
  56.           981|   
  57.           982|            WinSendDlgItemMsg (hwnd, DID_DIRLIST, LM_INSERTITEM,
  58. edlg.c                                                                  Page 22
  59.  
  60.           983|               MPFROM2SHORT (LIT_END, 0), MPFROMP (szDrive));
  61.           984|         }
  62.           985|      }
  63.           986|   
  64.           987|      DosFindFirst ("*.*", &hDir, 0x0010, &findbuf, sizeof findbuf,
  65.           988|         &usSearchCount, 0L);
  66.           989|      while (usSearchCount) {
  67.           990|         if (findbuf.attrFile & 0x0010 &&
  68.           991|          (findbuf.achName[0] != '.' || findbuf.achName[1])) {
  69.           992|            WinSendDlgItemMsg (hwnd, DID_DIRLIST, LM_INSERTITEM,
  70.           993|               MPFROM2SHORT (LIT_SORTASCENDING, 0), MPFROMP (findbuf.achName));
  71.           994|         }                            
  72.           995|         DosFindNext (hDir, &findbuf, sizeof findbuf, &usSearchCount);
  73.           996|      }
  74.           997|   }
  75.           998|   
  76.           999|   
  77.          1000|   /* fill file box with filenames */
  78.          1001|   /* by Charles Petzold, from Programming the OS/2 Presentation Manager */
  79.          1002|   VOID FillFileListBox (HWND hwnd)
  80.          1003|   {
  81.          1004|      FILEFINDBUF findbuf;
  82.          1005|      HDIR hDir = 1;
  83.          1006|      USHORT usSearchCount = 1;
  84.          1007|   
  85.          1008|      WinSendDlgItemMsg (hwnd, DID_FILELIST, LM_DELETEALL, NULL, NULL);
  86.          1009|   
  87.          1010|      DosFindFirst ("*.*", &hDir, 0x0000, &findbuf, sizeof findbuf,
  88.          1011|         &usSearchCount, 0L);
  89.          1012|      while (usSearchCount) {
  90.          1013|         WinSendDlgItemMsg (hwnd, DID_FILELIST, LM_INSERTITEM,
  91.          1014|            MPFROM2SHORT (LIT_SORTASCENDING, 0),
  92.          1015|            MPFROMP (findbuf.achName));
  93.          1016|   
  94.          1017|         DosFindNext (hDir, &findbuf, sizeof findbuf, &usSearchCount);
  95.          1018|      }
  96.          1019|   }
  97.          1020|   
  98.          1021|   
  99.          1022|   /* window procedure for open file dialog box */
  100.          1023|   /* by Charles Petzold, from Programming the OS/2 Presentation Manager */
  101.          1024|   MRESULT EXPENTRY OpenDlgProc (HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2)
  102.          1025|   {
  103.          1026|      static CHAR szCurrentPath[80], szBuffer[80];
  104.          1027|      SHORT sSelect;
  105.          1028|   
  106.          1029|      switch (msg) {
  107.          1030|         case WM_INITDLG:
  108.          1031|            FillDirListBox (hwnd, szCurrentPath);
  109.          1032|            FillFileListBox (hwnd);
  110.          1033|   
  111.          1034|            WinSendDlgItemMsg (hwnd, DID_FILEEDIT, EM_SETTEXTLIMIT,
  112.          1035|               MPFROM2SHORT (70, 0), NULL);
  113.          1036|            return 0;
  114.          1037|   
  115. edlg.c                                                                  Page 23
  116.  
  117.          1038|         case WM_CONTROL:
  118.          1039|            if (SHORT1FROMMP (mp1) == DID_DIRLIST ||
  119.          1040|             SHORT1FROMMP (mp1) == DID_FILELIST) {
  120.          1041|               sSelect = SHORT1FROMMR (WinSendDlgItemMsg (hwnd,
  121.          1042|                                          SHORT1FROMMP (mp1),
  122.          1043|                                          LM_QUERYSELECTION, 
  123.          1044|                                          (MPARAM) 0L, (MPARAM) 0L));
  124.          1045|   
  125.          1046|               WinSendDlgItemMsg (hwnd, SHORT1FROMMP (mp1), LM_QUERYITEMTEXT,
  126.          1047|                  MPFROM2SHORT (sSelect, sizeof szBuffer), MPFROMP (szBuffer));
  127.          1048|            }
  128.          1049|   
  129.          1050|            switch (SHORT1FROMMP (mp1)) {             /* Control ID */
  130.          1051|               case DID_DIRLIST:
  131.          1052|                  switch (SHORT2FROMMP (mp1)) {   /* notification code */
  132.          1053|                     case LN_ENTER:
  133.          1054|                        if (szBuffer[0] == ' ')
  134.          1055|                           DosSelectDisk (szBuffer[1] - '@');
  135.          1056|                        else
  136.          1057|                                DosChDir (szBuffer, 0L);
  137.          1058|   
  138.          1059|                           FillDirListBox (hwnd, szCurrentPath);
  139.          1060|                           FillFileListBox (hwnd);
  140.          1061|   
  141.          1062|                           WinSetDlgItemText (hwnd, DID_FILEEDIT, "");
  142.          1063|                           return 0;
  143.          1064|                  }
  144.          1065|                  break;
  145.          1066|   
  146.          1067|               case DID_FILELIST:
  147.          1068|                  switch (SHORT2FROMMP (mp1)) {   /* notification code */
  148.          1069|                     case LN_SELECT:
  149.          1070|                        WinSetDlgItemText (hwnd, DID_FILEEDIT, szBuffer);
  150.          1071|                        return 0;
  151.          1072|   
  152.          1073|                     case LN_ENTER:
  153.          1074|                        ParseFileName (szFileName, szBuffer);
  154.          1075|                        WinDismissDlg (hwnd, TRUE);
  155.          1076|                        return 0;
  156.          1077|                  }
  157.          1078|                  break;
  158.          1079|            }
  159.          1080|            break;
  160.          1081|   
  161.          1082|         case WM_COMMAND:
  162.          1083|            switch (COMMANDMSG(&msg)->cmd) {
  163.          1084|               case DID_OK:
  164.          1085|                  WinQueryDlgItemText (hwnd, DID_FILEEDIT,
  165.          1086|                     sizeof szBuffer, szBuffer);
  166.          1087|   
  167.          1088|                  switch (ParseFileName (szCurrentPath, szBuffer)) {
  168.          1089|                     case 0:
  169.          1090|                        WinAlarm (HWND_DESKTOP, WA_ERROR);
  170.          1091|                        FillDirListBox (hwnd, szCurrentPath);
  171.          1092|                        FillFileListBox (hwnd);
  172. edlg.c                                                                  Page 24
  173.  
  174.          1093|                        return 0;
  175.          1094|   
  176.          1095|                     case 1:
  177.          1096|                        WinAlarm (HWND_DESKTOP, WA_NOTE);
  178.          1097|                        FillDirListBox (hwnd, szCurrentPath);
  179.          1098|                        FillFileListBox (hwnd);
  180.          1099|                        WinSetDlgItemText (hwnd, DID_FILEEDIT, "");
  181.          1100|                        return 0;
  182.          1101|   
  183.          1102|                     case 2:
  184.          1103|                        strcpy (szFileName, szCurrentPath);
  185.          1104|                        WinDismissDlg (hwnd, TRUE);
  186.          1105|                        return 0;
  187.          1106|                  }
  188.          1107|                  break;
  189.          1108|   
  190.          1109|                  case DID_CANCEL:
  191.          1110|                     WinDismissDlg (hwnd, FALSE);
  192.          1111|                     return 0;
  193.          1112|            }
  194.          1113|            break;
  195.          1114|      }
  196.          1115|      return WinDefDlgProc (hwnd, msg, mp1, mp2);
  197.          1116|   }
  198.          1117|   
  199.          1118|   
  200.          1119|   /* window procedure for save as dialog box */
  201.          1120|   /* by Charles Petzold, from Programming the OS/2 Presentation Manager */
  202.          1121|   /* Modified (from OpenDlgProc) by Brian R. Anderson */
  203.          1122|   MRESULT EXPENTRY SaveasDlgProc (HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2)
  204.          1123|   {
  205.          1124|      static CHAR szCurrentPath[80], szBuffer[80];
  206.          1125|      SHORT sSelect;
  207.          1126|   
  208.          1127|      switch (msg) {
  209.          1128|         case WM_INITDLG:
  210.          1129|            FillDirListBox (hwnd, szCurrentPath);
  211.          1130|   
  212.          1131|            WinSendDlgItemMsg (hwnd, DID_FILEEDIT, EM_SETTEXTLIMIT,
  213.          1132|               MPFROM2SHORT (70, 0), NULL);
  214.          1133|            return 0;
  215.          1134|   
  216.          1135|         case WM_CONTROL:
  217.          1136|            if (SHORT1FROMMP (mp1) == DID_DIRLIST) {
  218.          1137|               sSelect = SHORT1FROMMR (WinSendDlgItemMsg (hwnd,
  219.          1138|                                          SHORT1FROMMP (mp1),
  220.          1139|                                          LM_QUERYSELECTION, 
  221.          1140|                                          (MPARAM) 0L, (MPARAM) 0L));
  222.          1141|   
  223.          1142|               WinSendDlgItemMsg (hwnd, SHORT1FROMMP (mp1), LM_QUERYITEMTEXT,
  224.          1143|                  MPFROM2SHORT (sSelect, sizeof szBuffer), MPFROMP (szBuffer));
  225.          1144|            }
  226.          1145|   
  227.          1146|            switch (SHORT1FROMMP (mp1)) {             /* Control ID */
  228.          1147|               case DID_DIRLIST:
  229. edlg.c                                                                  Page 25
  230.  
  231.          1148|                  switch (SHORT2FROMMP (mp1)) {   /* notification code */
  232.          1149|                     case LN_ENTER:
  233.          1150|                        if (szBuffer[0] == ' ')
  234.          1151|                           DosSelectDisk (szBuffer[1] - '@');
  235.          1152|                        else
  236.          1153|                                DosChDir (szBuffer, 0L);
  237.          1154|   
  238.          1155|                           FillDirListBox (hwnd, szCurrentPath);
  239.          1156|                           FillFileListBox (hwnd);
  240.          1157|   
  241.          1158|                           WinSetDlgItemText (hwnd, DID_FILEEDIT, "");
  242.          1159|                           return 0;
  243.          1160|                  }
  244.          1161|                  break;
  245.          1162|            }
  246.          1163|            break;
  247.          1164|   
  248.          1165|         case WM_COMMAND:
  249.          1166|            switch (COMMANDMSG(&msg)->cmd) {
  250.          1167|               case DID_OK:
  251.          1168|                  WinQueryDlgItemText (hwnd, DID_FILEEDIT,
  252.          1169|                     sizeof szBuffer, szBuffer);
  253.          1170|   
  254.          1171|                  switch (ParseFileName (szCurrentPath, szBuffer)) {
  255.          1172|                     case 0:
  256.          1173|                        WinAlarm (HWND_DESKTOP, WA_ERROR);
  257.          1174|                        FillDirListBox (hwnd, szCurrentPath);
  258.          1175|                        FillFileListBox (hwnd);
  259.          1176|                        return 0;
  260.          1177|   
  261.          1178|                     case 1:
  262.          1179|                        WinAlarm (HWND_DESKTOP, WA_NOTE);
  263.          1180|                        FillDirListBox (hwnd, szCurrentPath);
  264.          1181|                        WinSetDlgItemText (hwnd, DID_FILEEDIT, "");
  265.          1182|                        return 0;
  266.          1183|   
  267.          1184|                     case 2:
  268.          1185|                        strcpy (szFileName, szCurrentPath);
  269.          1186|                        WinDismissDlg (hwnd, TRUE);
  270.          1187|                        return 0;
  271.          1188|                  }
  272.          1189|                  break;
  273.          1190|   
  274.          1191|               case DID_CANCEL:
  275.          1192|                  WinDismissDlg (hwnd, FALSE);
  276.          1193|                  return 0;
  277.          1194|            }
  278.          1195|            break;
  279.          1196|      }
  280.          1197|      return WinDefDlgProc (hwnd, msg, mp1, mp2);
  281.          1198|   }
  282.          1199|   
  283.          1200|   
  284.          1201|   /* determine if pathname is a valid file or directory */
  285.          1202|   /* by Charles Petzold, from Programming the OS/2 Presentation Manager */
  286. edlg.c                                                                  Page 26
  287.  
  288.          1203|   SHORT ParseFileName (CHAR *pcOut, CHAR *pcIn)
  289.          1204|   {
  290.          1205|   /*
  291.          1206|    *   Input:    pcOut -- Pointer to parsed file specification.
  292.          1207|    *             pcIn  -- Pointer to raw file specification.
  293.          1208|    *                      
  294.          1209|    *   Returns:      0 -- pcIn had invalid drive or directory.
  295.          1210|    *                 1 -- pcIn was empty or had no filename.
  296.          1211|    *                 2 -- pcOut points to drive, full dir, and file name.
  297.          1212|    *
  298.          1213|    *   Changes current drive and directory per pcIn string.
  299.          1214|    */
  300.          1215|   
  301.          1216|      CHAR *pcLastSlash, *pcFileOnly;
  302.          1217|      ULONG ulDriveMap;
  303.          1218|      USHORT usDriveNum, usDirLen = 64;
  304.          1219|   
  305.          1220|      strupr (pcIn);
  306.          1221|   
  307.          1222|      /* If input string is empty, return 1 */
  308.          1223|      if (pcIn[0] == '\0')
  309.          1224|         return 1;
  310.          1225|   
  311.          1226|      /* Get drive from input string or current drive */
  312.          1227|      if (pcIn[1] == ':') {
  313.          1228|         if (DosSelectDisk (pcIn[0] - '@'))
  314.          1229|            return 0;
  315.          1230|   
  316.          1231|         pcIn += 2;
  317.          1232|      }
  318.          1233|      DosQCurDisk (&usDriveNum, &ulDriveMap);
  319.          1234|   
  320.          1235|      *pcOut++ = (CHAR)((CHAR) usDriveNum + '@');
  321.          1236|      *pcOut++ = ':';
  322.          1237|      *pcOut++ = '\\';
  323.          1238|   
  324.          1239|      /* If rest of string is empty, return 1 */
  325.          1240|      if (pcIn[0] == '\0')
  326.          1241|         return 1;
  327.          1242|   
  328.          1243|      /* Search for last backslash.  If none, could be directory. */
  329.          1244|      if (NULL == (pcLastSlash = strrchr (pcIn, '\\'))) {
  330.          1245|          if (!DosChDir (pcIn, 0L))
  331.          1246|            return 1;
  332.          1247|   
  333.          1248|         /* Otherwise, get current dir & attach input filename */
  334.          1249|         DosQCurDir (0, pcOut, &usDirLen);
  335.          1250|   
  336.          1251|         if (strlen (pcIn) > 12)
  337.          1252|            return 0;
  338.          1253|   
  339.          1254|         if (*(pcOut + strlen (pcOut) - 1) != '\\')
  340.          1255|            strcat (pcOut++, "\\");
  341.          1256|   
  342.          1257|         strcat (pcOut, pcIn);
  343. edlg.c                                                                  Page 27
  344.  
  345.          1258|         return 2;
  346.          1259|      }
  347.          1260|      
  348.          1261|      /* If the only backslash is at beginning, change to root */
  349.          1262|      if (pcIn == pcLastSlash) {
  350.          1263|          DosChDir ("\\", 0L);
  351.          1264|   
  352.          1265|         if (pcIn[1] == '\0')
  353.          1266|            return 1;
  354.          1267|   
  355.          1268|         strcpy (pcOut, pcIn + 1);
  356.          1269|         return 2;
  357.          1270|      }
  358.          1271|      
  359.          1272|      /* Attempt to change directory -- Get current dir if OK */
  360.          1273|      *pcLastSlash = '\0';
  361.          1274|   
  362.          1275|      if (DosChDir (pcIn, 0L))
  363.          1276|         return 0;
  364.          1277|   
  365.          1278|      DosQCurDir (0, pcOut, &usDirLen);
  366.          1279|   
  367.          1280|      /* Append input filename, if any */
  368.          1281|      pcFileOnly = pcLastSlash + 1;
  369.          1282|   
  370.          1283|      if (*pcFileOnly == '\0')
  371.          1284|         return 1;
  372.          1285|   
  373.          1286|      if (strlen (pcFileOnly) > 12)
  374.          1287|         return 0;
  375.          1288|   
  376.          1289|      if (*(pcOut + strlen (pcOut) - 1) != '\\')
  377.          1290|         strcat (pcOut++, "\\");
  378.          1291|   
  379.          1292|      strcat (pcOut, pcFileOnly);
  380.          1293|      return 2;
  381.          1294|   }
  382.          1295|   
  383.          1296|   
  384.          1297|   /* window procedure for find (text search) dialog box */
  385.          1298|   MRESULT EXPENTRY FindDlgProc (HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2)
  386.          1299|   {
  387.          1300|      switch (msg) {
  388.          1301|         case WM_INITDLG:
  389.          1302|           WinSendDlgItemMsg (hwnd, DID_FINDTEXT, EM_SETTEXTLIMIT,
  390.          1303|              MPFROM2SHORT (50, 0), NULL);
  391.          1304|            WinSetDlgItemText (hwnd, DID_FINDTEXT, szFind);
  392.          1305|            WinSetFocus (HWND_DESKTOP, WinWindowFromID (hwnd, DID_FINDTEXT));
  393.          1306|            return (MRESULT) TRUE;
  394.          1307|            
  395.          1308|         case WM_COMMAND:
  396.          1309|            switch (SHORT1FROMMP (mp1)) {
  397.          1310|               case DID_OK:
  398.          1311|                  if (WinQueryDlgItemText (hwnd, DID_FINDTEXT, 60, szFind))
  399.          1312|                     WinDismissDlg (hwnd, DID_OK);
  400. edlg.c                                                                  Page 28
  401.  
  402.          1313|                  else
  403.          1314|                     WinDismissDlg (hwnd, DID_CANCEL);
  404.          1315|                  return 0;
  405.          1316|                  
  406.          1317|               case DID_CANCEL:
  407.          1318|                  WinDismissDlg (hwnd, DID_CANCEL);
  408.          1319|                  return 0;
  409.          1320|                  
  410.          1321|               default:
  411.          1322|                  break;
  412.          1323|            }
  413.          1324|      }
  414.          1325|      return WinDefDlgProc (hwnd, msg, mp1, mp2);
  415.          1326|   }
  416.          1327|   
  417.          1328|   
  418.          1329|   /* window procedure for replace (text search and replace) dialog box */
  419.          1330|   MRESULT EXPENTRY ReplaceDlgProc (HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2)
  420.          1331|   {
  421.          1332|      BOOL FAR *pb;
  422.          1333|      
  423.          1334|      switch (msg) {
  424.          1335|         case WM_INITDLG:
  425.          1336|            WinSendDlgItemMsg (hwnd, DID_NEWTEXT, EM_SETTEXTLIMIT,
  426.          1337|               MPFROM2SHORT (50, 0), NULL);
  427.          1338|            WinSendDlgItemMsg (hwnd, DID_OLDTEXT, EM_SETTEXTLIMIT,
  428.          1339|               MPFROM2SHORT (50, 0), NULL);
  429.          1340|            WinSetDlgItemText (hwnd, DID_OLDTEXT, szFind);
  430.          1341|            WinSetDlgItemText (hwnd, DID_NEWTEXT, szReplace);
  431.          1342|            pb = (PVOID) mp2;   /* TRUE if first entry */
  432.          1343|            if (*pb) {
  433.          1344|               WinEnableWindow (WinWindowFromID (hwnd, DID_DOREPLACE), FALSE);
  434.          1345|               WinEnableWindow (WinWindowFromID (hwnd, DID_REPLACEALL), FALSE);
  435.          1346|               WinSetFocus (HWND_DESKTOP, WinWindowFromID (hwnd, DID_OLDTEXT));
  436.          1347|            }
  437.          1348|            else
  438.          1349|               WinSetFocus (HWND_DESKTOP, WinWindowFromID (hwnd, DID_NEWTEXT));
  439.          1350|            return (MRESULT) TRUE;
  440.          1351|            
  441.          1352|         case WM_COMMAND:
  442.          1353|            switch (SHORT1FROMMP (mp1)) {
  443.          1354|               case DID_OK:
  444.          1355|                  if (WinQueryDlgItemText (hwnd, DID_OLDTEXT, 60, szFind)) {
  445.          1356|                     WinQueryDlgItemText (hwnd, DID_NEWTEXT, 60, szReplace);
  446.          1357|                     WinDismissDlg (hwnd, DID_OK);
  447.          1358|                  }
  448.          1359|                  else
  449.          1360|                     WinDismissDlg (hwnd, DID_CANCEL);
  450.          1361|                  return 0;
  451.          1362|                  
  452.          1363|               case DID_DOREPLACE:
  453.          1364|                  if (WinQueryDlgItemText (hwnd, DID_NEWTEXT, 60, szReplace))
  454.          1365|                     WinDismissDlg (hwnd, DID_DOREPLACE);
  455.          1366|                  else
  456.          1367|                     WinDismissDlg (hwnd, DID_CANCEL);
  457. edlg.c                                                                  Page 29
  458.  
  459.          1368|                  break;
  460.          1369|                  
  461.          1370|               case DID_REPLACEALL:
  462.          1371|                  if (WinQueryDlgItemText (hwnd, DID_NEWTEXT, 60, szReplace))
  463.          1372|                     WinDismissDlg (hwnd, DID_REPLACEALL);
  464.          1373|                  else
  465.          1374|                     WinDismissDlg (hwnd, DID_CANCEL);
  466.          1375|                  break;
  467.          1376|                  
  468.          1377|               case DID_CANCEL:
  469.          1378|                  WinDismissDlg (hwnd, DID_CANCEL);
  470.          1379|                  return 0;
  471.          1380|                  
  472.          1381|               default:
  473.          1382|                  break;
  474.          1383|            }
  475.          1384|      }
  476.          1385|      return WinDefDlgProc (hwnd, msg, mp1, mp2);
  477.          1386|   }
  478.          1387|   
  479.          1388|   
  480.          1389|   /* window procedure for find (text search) dialog box */
  481.          1390|   MRESULT EXPENTRY GoLnDlgProc (HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2)
  482.          1391|   {
  483.          1392|      switch (msg) {
  484.          1393|         case WM_INITDLG:
  485.          1394|            WinSetFocus (HWND_DESKTOP, WinWindowFromID (hwnd, DID_LINENBR));
  486.          1395|            return (MRESULT) TRUE;
  487.          1396|            
  488.          1397|         case WM_COMMAND:
  489.          1398|            switch (SHORT1FROMMP (mp1)) {
  490.          1399|               case DID_OK:
  491.          1400|                  if (WinQueryDlgItemText (hwnd, DID_LINENBR, 20, szLine))
  492.          1401|                     WinDismissDlg (hwnd, DID_OK);
  493.          1402|                  else
  494.          1403|                     WinDismissDlg (hwnd, DID_CANCEL);
  495.          1404|                  return 0;
  496.          1405|                  
  497.          1406|               case DID_CANCEL:
  498.          1407|                  WinDismissDlg (hwnd, DID_CANCEL);
  499.          1408|                  return 0;
  500.          1409|                  
  501.          1410|               default:
  502.          1411|                  break;
  503.          1412|            }
  504.          1413|      }
  505.          1414|      return WinDefDlgProc (hwnd, msg, mp1, mp2);
  506.          1415|   }
  507.          1416|   
  508.