home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 3 Comm / 03-Comm.zip / CKPM5X_S.ZIP / CKOPM5.C < prev    next >
C/C++ Source or Header  |  1990-05-19  |  20KB  |  655 lines

  1. /******************************************************************************
  2. File name:  ckopm5.c    Rev: 01  Date: 29-Apr-90 Programmer: C.P.Armstrong
  3.  
  4. File title: Yet more PM interdace!
  5.  
  6. Contents:   File open dialog stuff
  7.  
  8. Modification History:
  9.     01  29-Apr-90   C.P.Armstrong   created
  10.  
  11. ******************************************************************************/
  12. #define INCL_AVIO
  13. #define INCL_WIN
  14. #define INCL_GPI
  15. #include <os2.h>
  16. #include <stdio.h>
  17. #include <string.h>
  18. #include <stdlib.h>
  19. #include "ckorc.h"
  20. #include "ckopm.h"
  21.  
  22.  
  23.  
  24. SHORT ParseFileName (CHAR *pcOut, CHAR *pcIn)
  25.      {
  26.           /*----------------------------------------------------------------
  27.              Input:    pcOut -- Pointer to parsed file specification.
  28.                        pcIn  -- Pointer to raw file specification.
  29.                        
  30.              Returns:  0 -- pcIn had invalid drive or directory.
  31.                        1 -- pcIn was empty or had no filename.
  32.                        2 -- pcOut points to drive, full dir, and file name.
  33.  
  34.              Changes current drive and directory per pcIn string.
  35.             ----------------------------------------------------------------*/
  36.  
  37.      CHAR   *pcLastSlash, *pcFileOnly ;
  38.      ULONG  ulDriveMap ;
  39.      USHORT usDriveNum, usDirLen = 64 ;
  40.  
  41.      strupr (pcIn) ;
  42.  
  43.                // If input string is empty, return 1
  44.  
  45.      if (pcIn [0] == '\0')
  46.           return 1 ;
  47.  
  48.                // Get drive from input string or current drive
  49.  
  50.      if (pcIn [1] == ':')
  51.           {
  52.           if (DosSelectDisk (pcIn [0] - '@'))
  53.                return 0 ;
  54.  
  55.           pcIn += 2 ;
  56.           }
  57.      DosQCurDisk (&usDriveNum, &ulDriveMap) ;
  58.  
  59.      *pcOut++ = (CHAR) usDriveNum + '@' ;
  60.      *pcOut++ = ':' ;
  61.      *pcOut++ = '\\' ;
  62.  
  63.                // If rest of string is empty, return 1
  64.  
  65.      if (pcIn [0] == '\0')
  66.           return 1 ;
  67.  
  68.                // Search for last backslash.  If none, could be directory.
  69.  
  70.      if (NULL == (pcLastSlash = strrchr (pcIn, '\\')))
  71.           {
  72.       if (!DosChDir (pcIn, 0L))
  73.                return 1 ;
  74.  
  75.                     // Otherwise, get current dir & attach input filename
  76.  
  77.           DosQCurDir (0, pcOut, &usDirLen) ;
  78.  
  79.           if (strlen (pcIn) > 12)
  80.                return 0 ;
  81.  
  82.           if (*(pcOut + strlen (pcOut) - 1) != '\\')
  83.                strcat (pcOut++, "\\") ;
  84.  
  85.           strcat (pcOut, pcIn) ;
  86.           return 2 ;
  87.           }
  88.                // If the only backslash is at beginning, change to root
  89.  
  90.      if (pcIn == pcLastSlash)
  91.           {
  92.       DosChDir ("\\", 0L) ;
  93.  
  94.           if (pcIn [1] == '\0')
  95.                return 1 ;
  96.  
  97.           strcpy (pcOut, pcIn + 1) ;
  98.           return 2 ;
  99.           }
  100.                // Attempt to change directory -- Get current dir if OK
  101.  
  102.      *pcLastSlash = '\0' ;
  103.  
  104.      if (DosChDir (pcIn, 0L))
  105.           return 0 ;
  106.  
  107.      DosQCurDir (0, pcOut, &usDirLen) ;
  108.  
  109.                // Append input filename, if any
  110.  
  111.      pcFileOnly = pcLastSlash + 1 ;
  112.  
  113.      if (*pcFileOnly == '\0')
  114.           return 1 ;
  115.  
  116.      if (strlen (pcFileOnly) > 12)
  117.           return 0 ;
  118.  
  119.      if (*(pcOut + strlen (pcOut) - 1) != '\\')
  120.           strcat (pcOut++, "\\") ;
  121.  
  122.      strcat (pcOut, pcFileOnly) ;
  123.      return 2 ;
  124.      }
  125.  
  126. /******************************************************************************
  127. Function:       FillDirListBox()
  128.  
  129. Description:    Fills a PM list box with available drives and directories
  130.  
  131. Syntax:         VOID FillDirListBox (HWND hwnd, CHAR *pcCurrentPath)
  132.  
  133. Returns:        nothing
  134.  
  135. Mods:           ??-???-?? C.Petzold created
  136.  
  137. ******************************************************************************/
  138. VOID FillDirListBox (HWND hwnd, CHAR *pcCurrentPath)
  139.      {
  140.      static CHAR szDrive [] = "  :" ;
  141.      FILEFINDBUF findbuf ;
  142.      HDIR        hDir = 1 ;
  143.      SHORT       sDrive ;
  144.      USHORT      usDriveNum, usCurPathLen, usSearchCount = 1 ;
  145.      ULONG       ulDriveMap ;
  146.  
  147.      DosQCurDisk (&usDriveNum, &ulDriveMap) ;
  148.      pcCurrentPath [0] = (CHAR) usDriveNum + '@' ;
  149.      pcCurrentPath [1] = ':' ;
  150.      pcCurrentPath [2] = '\\' ;
  151.      usCurPathLen = 64 ;
  152.      DosQCurDir (0, pcCurrentPath + 3, &usCurPathLen) ;
  153.  
  154.      WinSetDlgItemText (hwnd, DID_LG_CD, pcCurrentPath) ;
  155.      WinSendDlgItemMsg (hwnd, DID_DIRLIST, LM_DELETEALL, NULL, NULL) ;
  156.  
  157.      for (sDrive = 0 ; sDrive < 26 ; sDrive++)
  158.           if (ulDriveMap & 1L << sDrive)
  159.                {
  160.                szDrive [1] = (CHAR) sDrive + 'A' ;
  161.  
  162.                WinSendDlgItemMsg (hwnd, DID_DIRLIST, LM_INSERTITEM,
  163.                                   MPFROM2SHORT (LIT_END, 0),
  164.                                   MPFROMP (szDrive)) ;
  165.                }
  166.  
  167.      DosFindFirst ("*.*", &hDir, 0x0017, &findbuf, sizeof findbuf,
  168.                               &usSearchCount, 0L) ;
  169.      while (usSearchCount)
  170.           {
  171.           if (findbuf.attrFile & 0x0010 &&
  172.                     (findbuf.achName [0] != '.' || findbuf.achName [1]))
  173.                
  174.                WinSendDlgItemMsg (hwnd, DID_DIRLIST, LM_INSERTITEM,
  175.                                   MPFROM2SHORT (LIT_SORTASCENDING, 0),
  176.                                   MPFROMP (findbuf.achName)) ;
  177.  
  178.           DosFindNext (hDir, &findbuf, sizeof findbuf, &usSearchCount) ;
  179.           }
  180.      }
  181.  
  182. /******************************************************************************
  183. Function:       FillFileListBox()
  184.  
  185. Description:    Gets fills a PM list box with file names in current
  186.                 directory satisfying the selection pattern supplied
  187.  
  188. Syntax:         VOID FillFileListBox (HWND hwnd,char * fspec)
  189.  
  190. Returns:        nothing
  191.  
  192. Mods:           ??-???-?? C.Petzold created
  193.                 29-Apr-90 C.P.Armstrong filespec added
  194.  
  195. ******************************************************************************/
  196. VOID FillFileListBox (HWND hwnd,char * fspec)
  197.      {
  198.      FILEFINDBUF findbuf ;
  199.      HDIR        hDir = 1 ;
  200.      USHORT      usSearchCount = 1 ;
  201.      static char fs[80];
  202.  
  203.      if(fs[0]==0)
  204.         strcpy(fs,"*.*");
  205.  
  206.      if(fspec!=NULL)
  207.         strcpy(fs,fspec);
  208.  
  209.  
  210.      WinSendDlgItemMsg (hwnd, DID_FILELIST, LM_DELETEALL, NULL, NULL) ;
  211.  
  212.      DosFindFirst (fs, &hDir, 0x0007, &findbuf, sizeof findbuf,
  213.                               &usSearchCount, 0L) ;
  214.      while (usSearchCount)
  215.           {
  216.           WinSendDlgItemMsg (hwnd, DID_FILELIST, LM_INSERTITEM,
  217.                              MPFROM2SHORT (LIT_SORTASCENDING, 0),
  218.                              MPFROMP (findbuf.achName)) ;
  219.  
  220.           DosFindNext (hDir, &findbuf, sizeof findbuf, &usSearchCount) ;
  221.           }
  222.      }
  223.  
  224.  
  225. /******************************************************************************
  226. Function:       FileOpnDlgProc()
  227.  
  228. Description:    Handles the "Logging..." dialog.
  229.                 On receiving the WM_INITDLG message mp2 should point to
  230.                 an int value describing the logging mode desired.  This is
  231.                 used to set up various features of the dialog, like file name
  232.                 extension, dialog title and whether to close or open the
  233.                 file.
  234.                 Presently;
  235.                     mode = 0  is session logging
  236.                     mode = 1  is transaction logging
  237.                     mode = 2  is debug logging
  238.                     mode = 3  is packet logging
  239.  
  240. Syntax:         MRESULT EXPENTRY FileOpnDlgProc(hwnd,msg,mp1,mp2)
  241.                     HWND hwnd       Standard details passed to a 
  242.                     USHORT msg      client procedure
  243.                     MPARAM mp1
  244.                     MPARAM mp2
  245.  
  246. Returns:        0
  247.  
  248. Mods:           24-Mar-90 C.P.Armstrong created
  249.  
  250. ******************************************************************************/
  251. MRESULT EXPENTRY FileOpnDlgProc(HWND hwnd, USHORT msg, MPARAM mp1,MPARAM mp2)
  252.     {
  253.     static CHAR szBuffer [80] ;
  254.     static CHAR szCurrentPath [80];
  255.     SHORT       sSelect ;
  256.  
  257.     static char * deffs=NULL;
  258.  
  259.     static struct dlgopn * pdo;
  260.  
  261.     switch(msg)
  262.         {
  263.         case WM_INITDLG:
  264.             pdo = PVOIDFROMMP(mp2);
  265.             FileOpnDlgInit(hwnd,mp2,szCurrentPath);
  266.             pdo->name[0]='\0';
  267.             return(0);
  268.  
  269.         case WM_COMMAND:
  270.             switch(COMMANDMSG(&msg)->cmd)
  271.                 {
  272.                 case DID_LG_OPCL:      /* Selected the open/close button */
  273.                     if(FileOpnDlgExit(hwnd,szCurrentPath)!=0)
  274.                         return(0);
  275.                     else
  276.                         /* Copy filename to the supplied buffer */
  277.                         strcpy(pdo->name,szCurrentPath);    
  278.                 case DID_CANCEL:
  279.                     WinDismissDlg(hwnd,TRUE);
  280.                     pdo=NULL;
  281.                     return(0);
  282.                 default:
  283.                     break;
  284.                 }
  285.             break;
  286.         case WM_CONTROL:
  287.                if (SHORT1FROMMP (mp1) == DID_DIRLIST ||
  288.                    SHORT1FROMMP (mp1) == DID_FILELIST)
  289.                     {
  290.                     sSelect = (USHORT) WinSendDlgItemMsg (hwnd,
  291.                                                   SHORT1FROMMP (mp1),
  292.                                                   LM_QUERYSELECTION, 0L, 0L) ;
  293.  
  294.                     WinSendDlgItemMsg (hwnd, SHORT1FROMMP (mp1),
  295.                                        LM_QUERYITEMTEXT,
  296.                                        MPFROM2SHORT (sSelect, sizeof szBuffer),
  297.                                        MPFROMP (szBuffer)) ;
  298.                     }
  299.  
  300.                switch (SHORT1FROMMP (mp1))             // Control ID
  301.                     {
  302.                     case DID_DIRLIST:
  303.                          switch (SHORT2FROMMP (mp1))   // notification code
  304.                               {
  305.                               case LN_ENTER:
  306.                                    if (szBuffer [0] == ' ')
  307.                                         DosSelectDisk (szBuffer [1] - '@') ;
  308.                                    else
  309.                                         DosChDir (szBuffer, 0L) ;
  310.  
  311.                                    FillDirListBox (hwnd, szCurrentPath) ;
  312.                                    FillFileListBox (hwnd,NULL) ;
  313.  
  314.                                    return 0 ;
  315.                               }
  316.                          break ;
  317.  
  318.                     case DID_FILELIST:
  319.                          switch (SHORT2FROMMP (mp1))   // notification code
  320.                               {
  321.                               case LN_SELECT:
  322.                                    WinSetDlgItemText (hwnd, DID_LG_LOGNME,
  323.                                                       szBuffer) ;
  324.                                    return 0 ;
  325.  
  326.                               case LN_ENTER:
  327.                                    if(FileOpnDlgExit (hwnd,szCurrentPath) ==0)
  328.                                     {
  329.                                     strcpy(pdo->name,szCurrentPath);
  330.                                     WinDismissDlg (hwnd, TRUE) ;
  331.                                     pdo=NULL;
  332.                                     return 0 ;
  333.                                     }
  334.                               }     /* End of LN_ switch */
  335.                          break ;
  336.                     }   /* End of DID_ switch */
  337.                break ;
  338.  
  339.             
  340.         default:
  341.             break;
  342.         }
  343.     return(WinDefDlgProc(hwnd,msg,mp1,mp2));
  344.     }
  345.  
  346. /******************************************************************************
  347. Function:       FileOpnDlgInit()
  348.  
  349. Description:    Initialises the "Logging..." dialog according to the mode it
  350.                 has been invoked under, either "session", "transaction",
  351.                 "debugging" or "packet"
  352.  
  353. Syntax:         int FileOpnDlgInit(HWND hwnd,MPARAM mp1,char * path)
  354.  
  355. Returns:        0
  356.  
  357. Mods:           25-Mar-90 C.P.Armstrong created
  358.  
  359. ******************************************************************************/
  360. int FileOpnDlgInit(HWND hwnd,MPARAM mp2, char * path)
  361.     {
  362.     char drv[_MAX_DRIVE+_MAX_DIR]; /* Buffers required to break log file name */
  363.     char dir[_MAX_DIR];
  364.     char fname[_MAX_FNAME];        /* into it's components.                   */
  365. //    char defext[_MAX_EXT];
  366.  
  367.     char button[7];
  368.     char * title;
  369.     char * defext;
  370.  
  371.     struct dlgopn * pdo;
  372.     
  373.     pdo = PVOIDFROMMP(mp2);
  374.  
  375.     defext = pdo->name;
  376.     title  = pdo->title;
  377.  
  378.     
  379.     FillDirListBox (hwnd, path) ;       /* Fill the directory box */
  380.     FillFileListBox (hwnd,defext) ;     /* Fill the file box */
  381.  
  382.     WinSendDlgItemMsg (hwnd, DID_LG_LOGNME, EM_SETTEXTLIMIT,
  383.                              MPFROM2SHORT (80, 0), NULL) ;
  384.  
  385.  
  386.     WinSetDlgItemText(hwnd,DID_LG_LOGNME,defext);
  387.     WinSetDlgItemText(hwnd,DID_LG_TITLE,title);
  388.     WinSetDlgItemText(hwnd,DID_LG_OPCL,"Open");
  389.     return(0);
  390.     }    
  391.  
  392.  
  393. /******************************************************************************
  394. Function:       FileOpnDlgExit()
  395.  
  396. Description:    Takes the values entered into the Logging dialog procedure
  397.                 and performs the required operation.
  398.  
  399. Syntax:         int FileOpnDlgExit(HWND hwnd,char * path)
  400.  
  401. Returns:        0
  402.  
  403. Mods:           25-Mar-90 C.P.Armstrong created
  404.  
  405. ******************************************************************************/
  406. int FileOpnDlgExit(HWND hwnd,char * path)
  407.     {
  408.     char buf[81];
  409.  
  410.     WinQueryDlgItemText(hwnd,DID_LG_OPCL,80,buf);
  411.     WinQueryDlgItemText (hwnd, DID_LG_LOGNME,
  412.                       80, buf) ;
  413.  
  414.     if(strchr(buf,'*')!=NULL)
  415.        {
  416.        FillDirListBox (hwnd, path) ;
  417.        FillFileListBox (hwnd,buf) ;
  418.        return(-1);
  419.        }
  420.  
  421.  
  422.     switch (ParseFileName (path, buf))
  423.          {
  424.          case 0:
  425.               WinAlarm (HWND_DESKTOP, WA_ERROR) ;
  426.               FillDirListBox (hwnd, path) ;
  427.               FillFileListBox (hwnd,NULL) ;
  428.               return -1 ;
  429.  
  430.          case 1:
  431.               FillDirListBox (hwnd, path) ;
  432.               FillFileListBox (hwnd,NULL) ;
  433.               WinSetDlgItemText (hwnd, DID_LG_LOGNME, "") ;
  434.               return -1 ;
  435.  
  436.          case 2:
  437.              /* Filename is in path.. */
  438.              break;
  439.          }
  440.         
  441.     return(0);
  442.     }
  443.  
  444.  
  445. /******************************************************************************
  446. Function:       FileOpnDlgCmnd()
  447.  
  448. Description:    This routine could be used to check the existence of files and
  449.                 directories and provide the user with messages to the effect
  450.                 that they do/do not already exist.
  451.                 
  452.                 Of course the "logging..." dialog could also include a list
  453.                 of files in the named directory, and this routine would be
  454.                 responsible for updating that list when the current name is
  455.                 changed.
  456.  
  457. Syntax:         int FileOpnDlgCmnd(HWND hwnd,int cmnd)
  458.  
  459. Returns:        -1 if command not processed.
  460.                 0  if command processed.
  461.  
  462. Mods:           25-Mar-90 C.P.Armstrong created
  463.  
  464. ******************************************************************************/
  465. int FileOpnDlgCmnd(HWND hwnd,int cmnd)
  466.     {
  467.     return(-1);
  468.     }
  469.     
  470. /******************************************************************************
  471. Function:       FileClsDlgProc()
  472.  
  473. Description:    Simply displays the name and nature of the open file
  474.                 and gives the user the option to close the file.  
  475.  
  476.                 On initialisation mp2 should point to a dlgopn structure. 
  477.                 On entering .name should have the name of the file to close
  478.                 and .title the title of the dialog.
  479.  
  480.                 On exit the first byte of name is set to a non-zero value.  
  481.                 0 indicates the user canceled the close request.    
  482.  
  483. Syntax:         MRESULT EXPENTRY FileClsDlgProc(hwnd,msg,mp1,mp2)
  484.                     mp2 should be a "struct dlgopn *"
  485.  
  486. Returns:        dlgopn.name[0] == 0  User canceled
  487.                 dlgopn.name[0] != 0  User wants to close
  488.  
  489. Mods:           30-Apr-90 C.P.Armstrong created
  490.  
  491. ******************************************************************************/
  492. MRESULT EXPENTRY FileClsDlgProc(HWND hwnd, USHORT msg, MPARAM mp1,MPARAM mp2)
  493.     {
  494.     static struct dlgopn * pdo;
  495.  
  496.     switch(msg)
  497.         {
  498.         case WM_INITDLG:
  499.             pdo = PVOIDFROMMP(mp2);
  500.             WinSetDlgItemText(hwnd,DID_LG_LOGNME,pdo->name);
  501.             WinSetDlgItemText(hwnd,DID_LG_TITLE,pdo->title);
  502.             pdo->name[0]='\0';
  503.             return(0);
  504.  
  505.         case WM_COMMAND:
  506.             switch(COMMANDMSG(&msg)->cmd)
  507.                 {
  508.                 case DID_LG_OPCL:      /* Selected the open/close button */
  509.                     pdo->name[0]='\1';
  510.                 case DID_CANCEL:
  511.                     WinDismissDlg(hwnd,TRUE);
  512.                     pdo=NULL;
  513.                     return(0);
  514.                 default:
  515.                     break;
  516.                 }
  517.             break;
  518.         }
  519.     return(WinDefDlgProc(hwnd,msg,mp1,mp2));
  520.     }
  521.  
  522.  
  523. int seslogdlg(HWND hwnd)
  524.     {
  525.     extern int seslog;
  526.     extern char sesfil[];
  527.     extern int sesopn(char*);
  528.  
  529.     struct dlgopn dlo;
  530.  
  531.     char fname[81];
  532.  
  533.     dlo.title = "Session Log";
  534.     dlo.name = fname;
  535.  
  536.     if(seslog)                 /* Already open - close it  */
  537.        {
  538.        strcpy(fname,sesfil);
  539.        WinDlgBox(HWND_DESKTOP,hwnd,FileClsDlgProc,(HMODULE)0,IDD_LG,&dlo);
  540.        if(fname[0]!='\0')
  541.          seslog=sesopn("");
  542.        }
  543.     else
  544.        {
  545.        strcpy(fname,"*.SES");
  546.        
  547.        /* Call the filename find dialog */
  548.        WinDlgBox(HWND_DESKTOP,hwnd,FileOpnDlgProc,(HMODULE)0,IDD_LG2,&dlo);
  549.        
  550.        if(fname[0]!='\0')
  551.           seslog=sesopn(fname);         
  552.        }
  553.     return(0);
  554.     }
  555.  
  556.  
  557. int tralogdlg(HWND hwnd)
  558.     {
  559.     extern int tralog;
  560.     extern char trafil[];
  561.     extern int traopn(char*);
  562.  
  563.     struct dlgopn dlo;
  564.  
  565.     char fname[81];
  566.  
  567.     dlo.title = "Transaction Log";
  568.     dlo.name = fname;
  569.  
  570.     if(tralog)                 /* Already open - close it  */
  571.        {
  572.        strcpy(fname,trafil);
  573.        WinDlgBox(HWND_DESKTOP,hwnd,FileClsDlgProc,(HMODULE)0,IDD_LG,&dlo);
  574.        if(fname[0]!='\0')
  575.          tralog=traopn("");
  576.        }
  577.     else
  578.        {
  579.        strcpy(fname,"*.TRN");
  580.        
  581.        /* Call the filename find dialog */
  582.        WinDlgBox(HWND_DESKTOP,hwnd,FileOpnDlgProc,(HMODULE)0,IDD_LG2,&dlo);
  583.        
  584.        if(fname[0]!='\0')
  585.           tralog=traopn(fname);         
  586.        }
  587.     return(0);
  588.     }
  589.  
  590. int deblogdlg(HWND hwnd)
  591.     {
  592.     extern int deblog;
  593.     extern char debfil[];
  594.     extern int debopn(char*);
  595.  
  596.     struct dlgopn dlo;
  597.  
  598.     char fname[81];
  599.  
  600.     dlo.title = "Debugging Log";
  601.     dlo.name = fname;
  602.  
  603.     if(deblog)                 /* Already open - close it  */
  604.        {
  605.        strcpy(fname,debfil);
  606.        WinDlgBox(HWND_DESKTOP,hwnd,FileClsDlgProc,(HMODULE)0,IDD_LG,&dlo);
  607.        if(fname[0]!='\0')
  608.          deblog=debopn("");
  609.        }
  610.     else
  611.        {
  612.        strcpy(fname,"*.DBG");
  613.        
  614.        /* Call the filename find dialog */
  615.        WinDlgBox(HWND_DESKTOP,hwnd,FileOpnDlgProc,(HMODULE)0,IDD_LG2,&dlo);
  616.        
  617.        if(fname[0]!='\0')
  618.             deblog=debopn(fname);         
  619.        }
  620.     return(0);
  621.     }
  622.  
  623. int pktlogdlg(HWND hwnd)
  624.     {
  625.     extern int pktlog;
  626.     extern char pktfil[];
  627.     extern int pktopn(char*);
  628.  
  629.     struct dlgopn dlo;
  630.  
  631.     char fname[81];
  632.  
  633.     dlo.title = "Packet Log";
  634.     dlo.name = fname;
  635.  
  636.     if(pktlog)                 /* Already open - close it  */
  637.        {
  638.        strcpy(fname,pktfil);
  639.        WinDlgBox(HWND_DESKTOP,hwnd,FileClsDlgProc,(HMODULE)0,IDD_LG,&dlo);
  640.        if(fname[0]!='\0')
  641.          pktlog=pktopn("");
  642.        }
  643.     else
  644.        {
  645.        strcpy(fname,"*.PKT");
  646.        
  647.        /* Call the filename find dialog */
  648.        WinDlgBox(HWND_DESKTOP,hwnd,FileOpnDlgProc,(HMODULE)0,IDD_LG2,&dlo);
  649.        
  650.        if(fname[0]!='\0')
  651.             pktlog=pktopn(fname);         
  652.        }
  653.     return(0);
  654.     }
  655.