Would you like to make this site your homepage? It's fast and easy...
Yes, Please make this my home page!
C++ Builder
void ListFiles(AnsiString dirName){
int RC,p;
TSearchRec SearchRec;
AnsiString ss;
RC=FindFirst(dirName+"*.*",faAnyFile,SearchRec);
while(RC==0){
if(SearchRec.Name!=".."&&SearchRec.Name!="."){
ss=dirName+SearchRec.Name;
if((SearchRec.Attr&faDirectory)==0)li->Add(ss);
if((SearchRec.Attr&faDirectory)>0)ListFiles(ss+"\\");}
RC=FindNext(SearchRec);}
// finally
FindClose(SearchRec);
TStringList *li;
li=new TStringList();
ListFiles("directory")
} |
copy and paste images
//copy
Clipboard()->Assign(Image1->Picture);
//paste
if(Clipboard()->HasFormat(CF_BITMAP))Image1->Picture->Bitmap->Assign(Clipboard());
add menu item
void __fastcall TForm1::AddMenuItem(AnsiString st,AnsiString st2,char a){
TMenuItem *NewItem=new TMenuItem(Form1);
NewItem->Caption=st;
NewItem->Hint=st2;
NewItem->Name="mn"+a;
NewItem->OnClick=mnClick;
NewItem->GroupIndex=1;
NewItem->RadioItem=true;
NewItem->ShortCut=ShortCut(a,TShiftState()<<ssCtrl);
File1->Add(NewItem);
}
void __fastcall TForm1::mnClick(TObject *Sender){
Edit1->Text=((TMenuItem*)Sender)->Caption;
Edit2->Text((TMenuItem*)Sender)->Hint;
((TMenuItem*)Sender)->Checked=true;
}
AddMenuItem(caption,hint,shortcut)
original cursor
#pragma resource "addicon.res"
Screen->Cursors[number]=LoadCursor((void*)HInstance,"resource name");
back