|
primo esempio mangia memoria
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
for (int i =0; i <FileListBox1->Items->Count; i++)
Image2->Picture->Bitmap->Handle = MyLoadPic(FileListBox1->Items->Strings[i].c_str(),false);
}
//---------------------------------------------------------------------------
HBITMAP TForm1::MyLoadPic(char *filename, bool Progressflag)
{
typedef HBITMAP (__stdcall *IMPPROC) (char *, bool);
IMPPROC ImpFunc;
HINSTANCE DllInstance;
HBITMAP ritval;
DllInstance=LoadLibrary("NViewLib.dll");
if(DllInstance != NULL){
ImpFunc =(IMPPROC) GetProcAddress(DllInstance,"NViewLibLoad");
if(ImpFunc != NULL) {
ImpFunc(filename,Progressflag);
ritval = ImpFunc(filename, Progressflag);
}
else {
ShowMessage("Funzione non trovata");
}
FreeLibrary(DllInstance);
}
else
ShowMessage("Manca la Libreria NViewLib");
return ritval;
}
//---------------------------------------------------------------------------
|