H
Hallo,
habe nun mal folgendes probiert.
Die DLL
#pragma argsused
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fwdreason, LPVOID lpvReserved)
{
return 1;
}
//---------------------------------------------------------------------------
__declspec (dllexport) int Test(int Cnt)
{
Cnt++;
return Cnt;
}
Meine Anwendung
typedef int (__stdcall *Test)(int Cnt);
Test _Test;
HINSTANCE DllHandle;
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
DllHandle = LoadLibrary("dll_.dll");
if(Handle == NULL)
{
Application->MessageBox("can not load DLL","error",MB_ICONSTOP);
}
else
{
_Test = (Test) GetProcAddress(DllHandle, "_Test");
if(_Test == NULL)Application->MessageBox("DLL Error","error",MB_ICONSTOP);
}
Cnt = 0;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Cnt = _Test(Cnt);
Edit1->Text = Cnt;
}
Funkt soweit, aber lasse ich in Button1Click das Edit1->Text = Cnt weg
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Cnt = _Test(Cnt);
}
gibt es beim Rücksprung eine Zugriffsverletzung.