//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
TStringList *list1 = new TStringList;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ListBox1MouseDown(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
if(Button == mbRight)
ListBox1->PopupMenu->Popup(Mouse->CursorPos.x,Mouse->CursorPos.y);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Add1Click(TObject *Sender)
{
OpenDialog1->Filter = "All Files *.*|*.*";
if(OpenDialog1->Execute()){
ListBox1->Items->Add(ExtractFileName(OpenDialog1->FileName));
list1->Add(OpenDialog1->FileName);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
const int buffsize = 256;
char buff[buffsize];
GetWindowsDirectory(buff, buffsize);
list1->SaveToFile( (String)buff + "\\lispLauncher.txt");
delete list1;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
if(!list1){
Beep();
MessageDlg("You do not have enough memory to run this application",mtError,TMsgDlgButtons()<<mbOK,0);
Application->Terminate();
}
const int buffsize = 256;
char buff[buffsize];
GetWindowsDirectory(buff, buffsize);
if(FileExists((String)buff + "\\lispLauncher.txt") ){
list1->LoadFromFile((String)buff + "\\lispLauncher.txt");
int listItems = list1->Count;
for(int x = 0; x < listItems; x++)
ListBox1->Items->Add(ExtractFileName(list1->Strings[x]));
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ListBox1DblClick(TObject *Sender)
{
for(int x = 0; x < list1->Count; x++)
if(StrComp(ExtractFileName(list1->Strings[x]).c_str(),ListBox1->Items->Strings[ListBox1->ItemIndex].c_str()) == 0)
ShellExecute(Handle,"open",list1->Strings[x].c_str(),0,0,1);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Delete1Click(TObject *Sender)
{
for(int x = 0; x < list1->Count; x++)
if(ListBox1->ItemIndex != -1)
if(StrComp(ExtractFileName(list1->Strings[x]).c_str(),ListBox1->Items->Strings[ListBox1->ItemIndex].c_str()) == 0){
list1->Delete(x);
ListBox1->Items->Delete(x);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::About1Click(TObject *Sender)
{
Beep();
MessageDlg("This program was coded by Jerome Scott II aka c_lisp",mtInformation,TMsgDlgButtons()<<mbOK,0);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Close1Click(TObject *Sender)
{
Application->Terminate();
}
//---------------------------------------------------------------------------