home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / borland / cb / setup / cbuilder / data.z / DIROUTX.CPP < prev    next >
C/C++ Source or Header  |  1997-02-28  |  2KB  |  50 lines

  1. //----------------------------------------------------------------------------
  2. //Borland C++Builder
  3. //Copyright (c) 1987, 1997 Borland International Inc. All Rights Reserved.
  4. //----------------------------------------------------------------------------
  5. //---------------------------------------------------------------------------
  6. #include <vcl\vcl.h>
  7. #pragma hdrstop
  8.  
  9. #include "diroutx.h"
  10. //---------------------------------------------------------------------------
  11. #pragma link "sampreg"
  12. #pragma resource "*.dfm"
  13. TForm1 *Form1;
  14. //---------------------------------------------------------------------------
  15. __fastcall TForm1::TForm1(TComponent* Owner)
  16.   : TForm(Owner)
  17. {
  18. }
  19. //---------------------------------------------------------------------------
  20. void __fastcall TForm1::DirectoryOutline1Change(TObject *Sender)
  21. {
  22.     FileListBox1->Directory=DirectoryOutline1->Directory;  
  23. }
  24. //---------------------------------------------------------------------
  25. void __fastcall TForm1::DriveComboBox1Change(TObject *Sender)
  26. {
  27.     DirectoryOutline1->Drive=DriveComboBox1->Drive;  
  28. }
  29. //---------------------------------------------------------------------
  30. void __fastcall TForm1::Edit1Change(TObject *Sender)
  31. {
  32.     FileListBox1->Mask=Edit1->Text;  
  33. }
  34. //---------------------------------------------------------------------
  35. void __fastcall TForm1::FileListBox1Change(TObject *Sender)
  36. {
  37.     // put some data in the memo
  38.     const int size=1024;
  39.     char buffer[size];
  40.     memset(buffer,0,size);
  41.     HFILE file=_lopen(FileListBox1->FileName.c_str(),OF_READ);
  42.     if (file!=NULL) _lread(file,buffer,size);
  43.     // nulls will terminate this too soon, so we will
  44.     // replace them with '.'
  45.     for (int i=0;i<1023;i++) if (buffer[i]==0) buffer[i]='.';
  46.     Memo1->Text=AnsiString(buffer);
  47.     _lclose(file);
  48. }
  49. //---------------------------------------------------------------------
  50.