[Back To Directory]

Report ListView Box:

1. Open Borland C++ Builder.
2. Place a Button on the form.
3. Place a ListView on the form and make its width at least 300 and height at least 150 with scrollbars.
4. Go to the Object Inspector and change the ViewStyle of ListView1 to vsReport and add one colomn. 5. Double click Button1.
6. Type the following red code in the Button1Click function:

//This is what the Button1Click function should look like:

void __fastcall TForm1::Button1Click(TObject *Sender)
{
   TListItem *LST;
   char tmp_str[256];
   char tmpstr[256];
   char szFullPath[256];

   AnsiString cookie, gCaption;

   WIN32_FIND_DATA w32;
   BOOL finding = TRUE;

   int cntr = 0;
   SHFILEINFO info;

   ListView1->Column[0]->Width = Form1->ListView1->Width;

   SHGetSpecialFolderPath(NULL, tmp_str, CSIDL_COOKIES, FALSE);
   ListView1->Items->Clear();
   strcpy(tmpstr, tmp_str);
   strcat(tmpstr, "\\");
   SetCurrentDirectory(tmpstr);
   strcat(tmpstr, "*");

   HANDLE hFile = FindFirstFile(tmpstr, &w32);

   while(finding)
   {
      if(!(w32.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
      {
         GetFullPathName(w32.cFileName, MAX_PATH, szFullPath, NULL);
         cookie = w32.cFileName;

         if(cookie.UpperCase() != "INDEX.DAT")
         {
            if(cntr == 0)
               cntr = 1;
            LST = ListView1->Items->Add();
            LST->Caption = w32.cFileName;
            gCaption = "Internet Cookies ";
            gCaption += cntr++;
            gCaption += " Item(s) Found";
            Form1->ListView1->Column[0]->Caption = gCaption;
         }
      }
   finding = FindNextFile(hFile, &w32);
   }
}
//---------------------------------------------------------------------------


6. Run the program, click Button1. ListView1 will be filled with a list of all the Internet Explorer or AOL cookies on your computer.



[Back To Directory]