home *** CD-ROM | disk | FTP | other *** search
/ Borland Programmer's Resource / Borland_Programmers_Resource_CD_1995.iso / winsock / wsftp32 / ws_child.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-19  |  16.0 KB  |  509 lines

  1. /***************************************************************************
  2.   Windows Sockets Client Application Support Module
  3.  
  4.   Written by:
  5.       John A. Junod             Internet: <junodj@gordon-emh2.army.mil>
  6.       267 Hillwood Street                 <zj8549@trotter.usma.edu>
  7.       Martinez, GA 30907      Compuserve: 72321,366 
  8.  
  9.   This program executable and all source code is released into the public
  10.   domain.  It would be nice (but is not required) to give me a little 
  11.   credit for any use of this code.  
  12.  
  13.   THE INFORMATION AND CODE PROVIDED IS PROVIDED AS IS WITHOUT WARRANTY 
  14.   OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO 
  15.   THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
  16.   PURPOSE. IN NO EVENT SHALL JOHN A. JUNOD BE LIABLE FOR ANY DAMAGES 
  17.   WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS 
  18.   OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF JOHN A. JUNOD HAS BEEN 
  19.   ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  20.  
  21. *****************************************************************************/
  22. /*
  23.   MODULE: WS_CHILD.C  (child window functions)
  24. */
  25.  
  26. //----------------------
  27. #include "ws_glob.h"
  28. #include "WS_ftp.H"
  29. //----------------------
  30. #include <dos.h>
  31. #include <ctype.h>
  32. //----------------------
  33.  
  34. #ifdef WIN32
  35. #include <io.h>
  36. #endif
  37.  
  38. BOOL bCanMKD,bCanRMD,bCanREN,bCanDELE,bIsQVT,bIsNCSA,bIs5000,bIsDual;
  39. BOOL bHELP=FALSE;
  40. int maxhfextent = 0;
  41. int maxhdextent = 0;
  42.  
  43. // lgk new function to return the width of a text string in a given window
  44. // and if greater than the horiz point reset the horiz extent
  45.  
  46. void check_scroll(hwnd,txt,var)
  47. HWND hwnd;
  48. char *txt;
  49. int *var;
  50. {
  51. // ok first get the client area to calculate max width
  52. RECT MyRect;
  53. int width = 0;
  54. HDC hdc;
  55. BOOLEAN rv = FALSE;
  56. int tlen = strlen(txt);
  57. SIZE mysize;
  58.  
  59.    GetClientRect(hwnd, (LPRECT)&MyRect);
  60.    ClientToScreen(hwnd, (LPPOINT)&MyRect.left);
  61.    ClientToScreen(hwnd, (LPPOINT)&MyRect.right);
  62.  
  63.    // now that we have these values subtract them to get the width
  64.    width = (int)(MyRect.right - MyRect.left);
  65. //   DoPrintf("text is %s len is %d",txt,tlen);
  66. //   DoPrintf("Window Width is %d",width);
  67.  
  68.    // now get the size of the text
  69.    hdc = GetDC(hwnd);
  70.    rv = GetTextExtentPoint(hdc,(LPCTSTR)txt,tlen,&mysize);
  71.    ReleaseDC(hwnd,hdc);
  72.    if (rv == FALSE)
  73.     DoPrintf("ERROR: get text extent failed ecode = %d",GetLastError());
  74.   else {
  75. //        DoPrintf("Got size for text %s of %d ",txt,(int)mysize.cx);
  76. //        DoPrintf("var for max extent = %d ",*var);
  77.        if (((int)mysize.cx > *var) && ((int)mysize.cx > width))
  78.           {
  79. //           DoPrintf("Resetting horiz extent");
  80.            SendMessage(hwnd,LB_SETHORIZONTALEXTENT,(int)mysize.cx,0l);
  81.            *var = (int)mysize.cx;
  82.           }
  83.   }
  84. }
  85.  
  86.  // lgk new routine to get local search string
  87.  
  88. char *localsearchstring()
  89.   {
  90.        unsigned char szBuf[120];
  91.        WORD cbText;
  92.  
  93.        *(WORD *) szBuf = sizeof(szBuf) -1; // sets the buffer size
  94.  
  95.        cbText = (WORD)SendMessage(hLdirBox,
  96.                  EM_GETLINE,(WPARAM)0,(DWORD)(LPSTR)szBuf);
  97.        szBuf[cbText] = '\0';
  98.        return szBuf;
  99.   }
  100.  
  101.   /* ---------------------------------------------------*/
  102.  
  103.   int CreateSubWindows(HWND hParent,HWND hInst)
  104. {
  105.   hLbxLDir = CreateWindow(
  106.     "LISTBOX", NULL,
  107.     LBS_STANDARD | WS_VSCROLL | WS_HSCROLL | WS_VISIBLE | WS_CHILD | LBS_EXTENDEDSEL |
  108.     LBS_NOTIFY,
  109.     (7*nWndx)/4,(31*nWndy)/8, (74*nWndx)/4, (50*nWndy)/8,
  110.     hParent, (HMENU)LST_LDIRS, hInst,  NULL);
  111.  
  112.   hLbxLFiles = CreateWindow(
  113.     "LISTBOX", NULL,
  114.     LBS_STANDARD | WS_VSCROLL | WS_HSCROLL | WS_VISIBLE | WS_CHILD | LBS_EXTENDEDSEL |
  115.     LBS_NOTIFY,
  116.     (7*nWndx)/4,(83*nWndy)/8, (74*nWndx)/4, (70*nWndy)/8,
  117.     hParent, (HMENU)LST_LFILES, hInst,  NULL);
  118.  
  119.   hLbxRDir = CreateWindow(
  120.     "LISTBOX", NULL,
  121.     LBS_STANDARD | WS_VSCROLL | WS_HSCROLL | WS_VISIBLE | WS_CHILD | LBS_EXTENDEDSEL |
  122.     LBS_NOTIFY,
  123.     (136*nWndx)/4,(31*nWndy)/8, (74*nWndx)/4, (50*nWndy)/8,
  124.     hParent, (HMENU)LST_RDIRS, hInst,  NULL);
  125.  
  126.   hLbxRFiles = CreateWindow(
  127.     "LISTBOX", NULL,
  128.     LBS_STANDARD | WS_VSCROLL | WS_HSCROLL | WS_VISIBLE | WS_CHILD | LBS_EXTENDEDSEL |
  129.     LBS_NOTIFY,
  130.     (136*nWndx)/4,(83*nWndy)/8, (74*nWndx)/4, (70*nWndy)/8,
  131.     hParent, (HMENU)LST_RFILES, hInst,  NULL);
  132.  
  133.   hBtnLCWD = CreateWindow(
  134.     "BUTTON", "ChgDir",
  135.     WS_CHILD | WS_VISIBLE,
  136.     (84*nWndx)/4,(32*nWndy)/8, (27*nWndx)/4, (14*nWndy)/8,
  137.     hParent, (HMENU)BTN_LCHANGE, hInst,  NULL);
  138.  
  139.   hBtnLMKD = CreateWindow(
  140.     "BUTTON", "MkDir",
  141.     WS_CHILD | WS_VISIBLE,
  142.     (84*nWndx)/4,(46*nWndy)/8, (27*nWndx)/4, (14*nWndy)/8,
  143.     hParent, (HMENU)BTN_LMKDIR, hInst,  NULL);
  144.   
  145.   hBtnLRMD = CreateWindow(
  146.     "BUTTON", "RmDir",
  147.     WS_CHILD | WS_VISIBLE,
  148.     (84*nWndx)/4,(60*nWndy)/8, (27*nWndx)/4, (14*nWndy)/8,
  149.     hParent, (HMENU)BTN_LRMDIR, hInst,  NULL);
  150.  
  151. // lgk new box for directory selection
  152.   hLdirBox = CreateWindow(
  153.     "EDIT", NULL,
  154.      WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL | WS_BORDER,
  155.     (84*nWndx)/4,(83*nWndy)/8, (27*nWndx)/4, (14*nWndy)/8,
  156.     hParent, (HMENU)TXT_LDIRSEL, hInst,  NULL);
  157.  
  158.   hBtnLDisplay = CreateWindow(
  159.     "BUTTON", "View",
  160.     WS_CHILD | WS_VISIBLE,
  161.     (84*nWndx)/4,(106*nWndy)/8, (27*nWndx)/4, (14*nWndy)/8,
  162.     hParent, (HMENU)BTN_LDISPLAY, hInst,  NULL);
  163.   hBtnLREN = CreateWindow(
  164.     "BUTTON", "Rename",
  165.     WS_CHILD | WS_VISIBLE,
  166.     (84*nWndx)/4,(120*nWndy)/8, (27*nWndx)/4, (14*nWndy)/8,
  167.     hParent, (HMENU)BTN_LRENAME, hInst,  NULL);
  168.   hBtnLDEL = CreateWindow(
  169.     "BUTTON", "Delete",
  170.     WS_CHILD | WS_VISIBLE,
  171.     (84*nWndx)/4,(134*nWndy)/8, (27*nWndx)/4, (14*nWndy)/8,
  172.     hParent, (HMENU)BTN_LDELETE, hInst,  NULL);
  173.  
  174.   hBtnRCWD = CreateWindow(
  175.     "BUTTON", "ChgDir",
  176.     WS_CHILD | WS_VISIBLE,
  177.     (213*nWndx)/4,(32*nWndy)/8, (27*nWndx)/4, (14*nWndy)/8,
  178.     hParent, (HMENU)BTN_RCHANGE, hInst,  NULL);
  179.   hBtnRMKD = CreateWindow(
  180.     "BUTTON", "MkDir",
  181.     WS_CHILD | WS_VISIBLE,
  182.     (213*nWndx)/4,(46*nWndy)/8, (27*nWndx)/4, (14*nWndy)/8,
  183.     hParent, (HMENU)BTN_RMKDIR, hInst,  NULL);
  184.   hBtnRRMD = CreateWindow(
  185.     "BUTTON", "RmDir",
  186.     WS_CHILD | WS_VISIBLE,
  187.     (213*nWndx)/4,(60*nWndy)/8, (27*nWndx)/4, (14*nWndy)/8,
  188.     hParent, (HMENU)BTN_RRMDIR, hInst,  NULL);
  189.   hRdirBox = CreateWindow(
  190.     "EDIT", NULL,
  191.      WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL | WS_BORDER,
  192.     (213*nWndx)/4,(83*nWndy)/8, (27*nWndx)/4, (14*nWndy)/8,
  193.     hParent, (HMENU)TXT_RDIRSEL, hInst,  NULL);
  194.   hBtnRDisplay = CreateWindow(
  195.     "BUTTON", "View",
  196.     WS_CHILD | WS_VISIBLE,
  197.     (213*nWndx)/4,(106*nWndy)/8, (27*nWndx)/4, (14*nWndy)/8,
  198.     hParent, (HMENU)BTN_RDISPLAY, hInst,  NULL);
  199.   hBtnRREN = CreateWindow(
  200.     "BUTTON", "Rename",
  201.     WS_CHILD | WS_VISIBLE,
  202.     (213*nWndx)/4,(120*nWndy)/8, (27*nWndx)/4, (14*nWndy)/8,
  203.     hParent, (HMENU)BTN_RRENAME, hInst,  NULL);
  204.   hBtnRDEL = CreateWindow(
  205.     "BUTTON", "Delete",
  206.     WS_CHILD | WS_VISIBLE,
  207.     (213*nWndx)/4,(134*nWndy)/8, (27*nWndx)/4, (14*nWndy)/8,
  208.     hParent, (HMENU)BTN_RDELETE, hInst,  NULL);
  209.  
  210.   hBtnLtoR = CreateWindow(
  211.     "BUTTON", "-->",
  212.     WS_CHILD | WS_VISIBLE,
  213.     (116*nWndx)/4,(118*nWndy)/8, (14*nWndx)/4, (14*nWndy)/8,
  214.     hParent, (HMENU)BTN_LOCAL_TO_REMOTE, hInst,  NULL);
  215.   hBtnRtoL = CreateWindow(
  216.     "BUTTON", "<--",
  217.     WS_CHILD | WS_VISIBLE,
  218.     (116*nWndx)/4,(101*nWndy)/8, (14*nWndx)/4, (14*nWndy)/8,
  219.     hParent, (HMENU)BTN_REMOTE_TO_LOCAL, hInst,  NULL);
  220.  
  221.   hBtnConnect = CreateWindow(
  222.     "BUTTON", "Connect",
  223.     WS_CHILD | WS_VISIBLE,
  224.     (4*nWndx)/4,(188*nWndy)/8, (34*nWndx)/4, (10*nWndy)/8,
  225.     hParent, (HMENU)BTN_CONNECT, hInst,  NULL);
  226.   hBtnClose = CreateWindow(
  227.     "BUTTON", "Close",
  228.     WS_CHILD | WS_VISIBLE,
  229.     (38*nWndx)/4,(188*nWndy)/8, (34*nWndx)/4, (10*nWndy)/8,
  230.     hParent, (HMENU)BTN_CLOSE, hInst,  NULL);
  231.  
  232.  // lgk move this button over and add new abort button
  233.   hBtnAbort = CreateWindow(
  234.    "BUTTON", "Abort",
  235.     WS_CHILD | WS_VISIBLE,
  236.     (72*nWndx)/4,(188*nWndy)/8, (34*nWndx)/4, (10*nWndy)/8,
  237.     hParent, (HMENU)BTN_ABORT, hInst,  NULL);
  238.  
  239.   hBtnLong = CreateWindow(
  240.     "BUTTON", "LongDir",
  241.     WS_CHILD | WS_VISIBLE,
  242.     (106*nWndx)/4,(188*nWndy)/8, (34*nWndx)/4, (10*nWndy)/8,
  243.     hParent, (HMENU)BTN_LONG, hInst,  NULL);
  244.  
  245.   hBtnOption= CreateWindow(
  246.     "BUTTON", "Options",
  247.     WS_CHILD | WS_VISIBLE,
  248.     (140*nWndx)/4,(188*nWndy)/8, (34*nWndx)/4, (10*nWndy)/8,
  249.     hParent, (HMENU)BTN_OPTION, hInst, NULL);
  250.   hBtnAbout = CreateWindow(
  251.     "BUTTON", "About",
  252.     WS_CHILD | WS_VISIBLE,
  253.     (174*nWndx)/4,(188*nWndy)/8, (34*nWndx)/4, (10*nWndy)/8,
  254.     hParent, (HMENU)BTN_ABOUT, hInst,  NULL);
  255.   hBtnExit = CreateWindow(
  256.     "BUTTON", "Exit",
  257.     WS_CHILD | WS_VISIBLE,
  258.     (208*nWndx)/4,(188*nWndy)/8, (34*nWndx)/4, (10*nWndy)/8,
  259.     hParent, (HMENU)BTN_EXIT, hInst,  NULL);
  260.  
  261.   hTxtLDir = CreateWindow(
  262.     "STATIC", NULL,
  263.     WS_CHILD | WS_VISIBLE | SS_LEFTNOWORDWRAP,
  264.     (9*nWndx)/4,(18*nWndy)/8, (100*nWndx)/4, (8*nWndy)/8,
  265.     hParent, (HMENU)TXT_LDIRECTORY, hInst,  NULL);
  266. /*
  267.   hTxtRHost = CreateWindow(
  268.     "STATIC", NULL,
  269.     WS_CHILD | WS_VISIBLE | SS_LEFTNOWORDWRAP,
  270.     (138*nWndx)/4,(7*nWndy)/8, (100*nWndx)/4, (8*nWndy)/8,
  271.     hParent, TXT_HOSTNAME, hInst,  NULL);
  272. */
  273.   hTxtRDir = CreateWindow(
  274.     "STATIC", NULL,
  275.     WS_CHILD | WS_VISIBLE | SS_LEFTNOWORDWRAP,
  276.     (138*nWndx)/4,(18*nWndy)/8, (100*nWndx)/4, (8*nWndy)/8,
  277.     hParent, (HMENU)TXT_RDIRECTORY, hInst,  NULL);
  278.  
  279.   hTxtStatus = CreateWindow(
  280.     "STATIC", NULL,
  281.     WS_CHILD | WS_VISIBLE | SS_LEFT,
  282.     (10*nWndx)/4,(167*nWndy)/8, (218*nWndx)/4, (8*nWndy)/8,
  283.     hParent, (HMENU)TXT_STATUS, hInst,  NULL);
  284.  
  285.   hTxtStatus1 = CreateWindow(
  286.     "STATIC", NULL,
  287.     WS_CHILD | WS_VISIBLE | SS_LEFT,
  288.     (10*nWndx)/4,(175*nWndy)/8, (218*nWndx)/4, (8*nWndy)/8,
  289.     hParent, (HMENU)TXT_STATUS, hInst,  NULL);
  290.  
  291.   hTxtLBytes = CreateWindow(
  292.     "STATIC", NULL,
  293.     WS_CHILD | WS_VISIBLE | SS_RIGHT,
  294.     (10*nWndx)/4,(155*nWndy)/8, (40*nWndx)/4, (8*nWndy)/8,
  295.     hParent, (HMENU)TXT_STATUS, hInst,  NULL);
  296.  
  297.   hTxtRBytes = CreateWindow(
  298.     "STATIC", NULL,
  299.     WS_CHILD | WS_VISIBLE | SS_RIGHT,
  300.     (198*nWndx)/4,(155*nWndy)/8, (40*nWndx)/4, (8*nWndy)/8,
  301.     hParent, (HMENU)TXT_STATUS, hInst,  NULL);
  302.  
  303.   hRBascii=CreateWindow(
  304.     "BUTTON", "ASCII",
  305.     WS_CHILD | WS_VISIBLE | BS_RADIOBUTTON,
  306.     (58*nWndx)/4,(155*nWndy)/8,(39*nWndx)/4,(10*nWndy)/8,
  307.     hParent, (HMENU)RB_ASCII, hInst, NULL);
  308.   hRBbinary=CreateWindow(
  309.     "BUTTON","Binary",
  310.     WS_CHILD | WS_VISIBLE | BS_RADIOBUTTON,
  311.     (103*nWndx)/4,(155*nWndy)/8,(39*nWndx)/4,(10*nWndy)/8,
  312.     hParent, (HMENU)RB_BINARY, hInst, NULL);
  313.   hRBl8=CreateWindow(
  314.     "BUTTON","L 8",
  315.     WS_CHILD | WS_VISIBLE | BS_RADIOBUTTON,
  316.     (148*nWndx)/4,(155*nWndy)/8,(39*nWndx)/4,(10*nWndy)/8,
  317.     hParent, (HMENU)RB_L8, hInst, NULL);
  318.  
  319.   hScroll=CreateWindow(
  320.     "SCROLLBAR",NULL,WS_CHILD | WS_VISIBLE |SBS_VERT, // SBS_LEFTALIGN
  321.     (228*nWndx)/4,(167*nWndy)/8,(10*nWndx)/4,(16*nWndy)/8,
  322.     hParent, (HMENU)SCRLWND, hInst,NULL);
  323.  
  324.  EnableWindow(hBtnAbort,FALSE);
  325.  EnableWindow(hBtnConnect,TRUE);
  326.  EnableWindow(hBtnClose,FALSE);
  327.  
  328.   return(TRUE);
  329. }
  330.  
  331.  
  332. HPEN hPenDark;
  333. HPEN hPenLight;
  334.  
  335. void BoxIt(HDC hDC,int left,int top,int width,int height,BOOL flag)
  336. {
  337.   if(flag) SelectObject(hDC,hPenDark); else SelectObject(hDC,hPenLight);
  338.   MoveToEx(hDC,(left*nWndx)/4,((top+height)*nWndy)/8,NULL);
  339.   LineTo(hDC,(left*nWndx)/4,(top*nWndy)/8);
  340.   LineTo(hDC,((left+width)*nWndx)/4,(top*nWndy)/8);
  341.   if(flag) SelectObject(hDC,hPenLight); else SelectObject(hDC,hPenDark);
  342.   LineTo(hDC,((left+width)*nWndx)/4,((top+height)*nWndy)/8);
  343.   LineTo(hDC,(left*nWndx)/4,((top+height)*nWndy)/8);
  344. }
  345.  
  346. void DoMainPaint(HWND hWnd)
  347. {
  348.   HDC         hDC;   // handle for the display device
  349.   PAINTSTRUCT ps;    // holds PAINT information
  350.   HBRUSH      hBrush;
  351.  
  352.   memset(&ps, 0x00, sizeof(PAINTSTRUCT));
  353.   hDC = BeginPaint(hWnd, &ps);
  354.  
  355.   hBrush=CreateSolidBrush(RGB(192,192,192));
  356.   hPenDark=CreatePen(PS_SOLID,1,RGB(128,128,128));
  357.   hPenLight=CreatePen(PS_SOLID,1,RGB(224,224,224));
  358. //
  359.   SelectObject(hDC,hBrush);
  360.   SelectObject(hDC,GetStockObject(ANSI_VAR_FONT));
  361.   SetBkColor(hDC,RGB(192,192,192));
  362. //
  363.   BoxIt(hDC,4,2,109,149,TRUE);
  364.   BoxIt(hDC,133,2,109,149,TRUE);
  365. //
  366.   BoxIt(hDC,7,5,103,10,TRUE);
  367.   TextOut(hDC,(9*nWndx)/4,(7*nWndy)/8,"Local PC info",13);
  368.   BoxIt(hDC,136,5,103,10,TRUE);
  369.   TextOut(hDC,(138*nWndx)/4,(7*nWndy)/8,"Remote host info",16);
  370. //              5     27
  371.   BoxIt(hDC,4,154,238,31,TRUE);  // file transfer types
  372. //              9     1
  373.   BoxIt(hDC,7,166,232,18,FALSE); // status text box
  374.   BoxIt(hDC,7,17,103,10,FALSE);
  375.   BoxIt(hDC,136,17,103,10,FALSE);
  376. // Inform Windows painting is complete
  377.   EndPaint(hWnd, &ps);
  378.   DeleteObject(hBrush);
  379.   DeleteObject(hPenLight);
  380.   DeleteObject(hPenDark);
  381. }
  382.  
  383. int GetLocalDirForWnd(HWND hWnd)
  384. {
  385.   char *searchstring = localsearchstring();
  386.   char tempstring[120];
  387.   
  388. #ifdef WIN32 
  389.   struct _finddata_t ffblk;
  390.   #define findnext(a) _findnext(a)
  391.   #define ff_name name
  392.   #define ff_attrib attrib
  393. #else
  394.   unsigned int nIndex;
  395. #ifdef _MSC_
  396.   #define ff_attrib attrib
  397.   #define ff_name name
  398.   #define findnext(a) _dos_findnext(a)
  399.   struct _find_t ffblk;
  400. #else
  401.   struct ffblk ffblk;
  402. #endif  
  403. #endif
  404.   int nDone;
  405.   long fhandle;
  406.  
  407.    maxhdextent = 0;
  408.    maxhfextent = 0;  
  409.    strcpy(tempstring,searchstring);
  410.  
  411.   // get the local directory name
  412.   // DLG_LDIRECTORY (directory name)
  413.   getcwd(szString,180);
  414.   SendMessage(hTxtLDir,WM_SETTEXT,0,(LPARAM)szString);
  415.   // DLG_LDIRS      (directory list box)
  416.   SendMessage(hLbxLDir,LB_RESETCONTENT,0,0);
  417.   // default is 5 chars for dirve names
  418.   SendMessage(hLbxLDir,LB_SETHORIZONTALEXTENT,5*9,0l);
  419.   fhandle =_findfirst("*.*",&ffblk);
  420.   
  421.   if (fhandle != -1)
  422.    nDone = 0;
  423.   else nDone = 1;
  424.  
  425.   // first go through all dirs
  426.   while (!nDone)  {
  427.     if(ffblk.attrib & 0x10 && strcmp(ffblk.name,".")!=0)
  428.       {
  429.        SendMessage(hLbxLDir,LB_ADDSTRING,0,(LONG)ffblk.name);
  430.        check_scroll(hLbxLDir,(LONG)ffblk.name,&maxhdextent);
  431.       }
  432.  
  433.     nDone = _findnext(fhandle,&ffblk);
  434.   }
  435.   _findclose(fhandle);
  436.  
  437.   // add drives to the list box
  438.   SendMessage(hLbxLDir, LB_DIR,0x4000 | 0x8000, (LPARAM) ((LPSTR) "*"));
  439.  
  440.   // DLG_LFILES     (file list box)
  441.    // lgk do not change this as it is adding drives
  442.    // lgk 7/94 new code for horiz scroll bars
  443.   SendMessage(hLbxLFiles,LB_RESETCONTENT,0,0);
  444.   SendMessage(hLbxLFiles,LB_SETHORIZONTALEXTENT,0,0l);
  445.  // lgk new code here to use search string if filled in
  446.  if (strlen(tempstring) == 0)
  447.   fhandle =_findfirst("*.*",&ffblk);
  448.  else fhandle =_findfirst(tempstring,&ffblk);
  449.  
  450.  if (fhandle != -1)
  451.    nDone = 0;
  452.   else nDone = 1;
  453.  
  454.  while (!nDone)  {
  455.     if(!(ffblk.attrib & 0x10)) {
  456.       strcpy(szString,ffblk.name);
  457.  
  458.       // lgk 10/94 comment out code here if on nt that is changing stuff
  459.       // to lower case which causes problem when going to unix
  460. #ifndef WIN32      
  461.       for(nIndex=0;nIndex<strlen(szString);nIndex++)
  462.         szString[nIndex]=tolower(szString[nIndex]);
  463. #endif
  464.       SendMessage(hLbxLFiles,LB_ADDSTRING,0,(LONG)szString);
  465.     // lgk 7/94 new code for horiz scroll bars
  466.      check_scroll(hLbxLFiles,(LONG)szString,&maxhfextent);
  467.     }
  468.     nDone = _findnext(fhandle,&ffblk);
  469.   }
  470.   _findclose(fhandle);
  471.   SendMessage(hLdirBox,EM_SETMODIFY,0,0);
  472.   return 0;
  473. }
  474.  
  475. #define MAXLINES 59
  476. char statuslines[60][81];
  477. int statusptr=0;
  478. int statusscroll=1;
  479.  
  480. void ScrollStatus(int value) {
  481.   statusscroll += value;
  482.   if(statusscroll<1)
  483.     statusscroll=1;
  484.   else if(statusscroll>statusptr)
  485.     statusscroll=statusptr;
  486.   else {
  487.     SetWindowText(hTxtStatus1,statuslines[statusscroll]);
  488.     SetWindowText(hTxtStatus,statuslines[statusscroll-1]);
  489.   }
  490.  
  491. }
  492.  
  493. void SetStatus(LPSTR string) {
  494.   int i;
  495.  
  496.   if(statusptr>(MAXLINES-1))
  497.     for(i=0;i<MAXLINES;i++)
  498.       strcpy(statuslines[i],statuslines[i+1]);
  499.  
  500.   strncpy(statuslines[statusptr],string,80);
  501.   statuslines[statusptr][80]=0;
  502.  
  503.   SetWindowText(hTxtStatus1,statuslines[statusptr]);
  504.   if(statusptr>0)
  505.     SetWindowText(hTxtStatus,statuslines[statusptr-1]);
  506.   statusscroll=statusptr;
  507.   if(statusptr<MAXLINES) statusptr++;
  508. }
  509.