//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
int tmpend;
DLLInst = NULL;
DLLInst = LoadLibrary("ZmzGetMp3Info.dll");
if(DLLInst)
{
GetInfo=(int (__stdcall*)(AnsiString filename,MP3_INFO *mp3info)) GetProcAddress(DLLInst, "GetInfo");
if (GetInfo)
{
if(odg->Execute())
{
mp3info=(MP3_INFO *)malloc(sizeof(MP3_INFO));
FillMemory(mp3info,sizeof(MP3_INFO),0);
tmpend=GetInfo(this->odg->FileName,mp3info);
if(tmpend==1)
{
txtname->Text =mp3info->Mp3Name;
txtplayer->Text =mp3info->Player ;
txtfrom->Text =mp3info->FormDisk ;
txtbakinfo->Text =mp3info->BakInfo;
}
else
{ShowMessage("无法读取信息");}
free(mp3info);
}
}
else
{
ShowMessage("取得函数指针失败");
}
FreeLibrary(DLLInst);
}
else
{
ShowMessage("动态库调用失败");
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
int tmpend;
DLLInst = NULL;
DLLInst = LoadLibrary("ZmzGetMp3Info.dll");
if(DLLInst)
{
SetInfo=(int (__stdcall*)(AnsiString filename,AnsiString Mp3Name,AnsiString Player,AnsiString Form,AnsiString BakInfo)) GetProcAddress(DLLInst, "SetInfo");
if (SetInfo)
{
if(odg->Execute())
{
tmpend=SetInfo(this->odg->FileName,txtname->Text,txtplayer->Text,txtfrom->Text,txtbakinfo->Text);
if(tmpend==1)
{
ShowMessage("成功写入");
}
else
{
ShowMessage("写入失败");
}
}
}
else
{
ShowMessage("取得函数指针失败");
}
FreeLibrary(DLLInst);
}
else
{
ShowMessage("动态库调用失败");
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
this->Close();
}
//---------------------------------------------------------------------------