hallo, ich habe ein dll problem. die situation ist folgende: ich habe ein programm und eine dll mit globalen variablen. ungefähr so:
<pre>
// --------------------- die dll ---------------------
#include <vcl.h>
#include <windows.h>
#pragma hdrstop
extern "C" __export void SetGlobalVar1(int Value);
extern "C" __export void SetGlobalVar2(char Value);
int GlobalVar1;
char GlobalVar2;
#pragma argsused
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
return 1;
}
void SetGlobalVar1(int Value)
{
GlobalVar1 = Value;
}
void SetGlobalVar2(char Value)
{
GlobalVar2 = Value;
}
</pre>
das programm ist nun im vordergrund (auf dem desktop), lädt die dll, sucht sich die functionen raus und ruft zb SetGlobalVar1(14) auf. dann hat GlobalVar1 den wert 14. wenn das jetzt so bleiben würde, wär alles gut. aber es bleibt nicht so, denn sobald das programmm nicht mehr im vordergrund ist, haben alle variablen den wert null (GlobalVar1 = 0, GlobalVar2 = 0). wenn das programm wieder in den vordergrund kommt, werden die alten werte wieder hergestellt. und ich hab absolut keine ahnung, warum das nicht functioniert!
ich wär extreeem dankbar, wenn mir jemand hilft. ich hab desswegen schon zwei tage verbracht (weil ich erst nicht wusste, das die vars auf null gesetz werden... und dachte desswegen, da sind imma irgendwelche fehler)
und vielleicht kann mir ja auch noch jemand sagen, ob man aus der dll eine function vom programm aufrufen kann (wenn man der dll während des laufens die addresse der function sagt).
bitte bitte bitte helft mir
thx sandman
<pre>
// --------------------- die dll ---------------------
#include <vcl.h>
#include <windows.h>
#pragma hdrstop
extern "C" __export void SetGlobalVar1(int Value);
extern "C" __export void SetGlobalVar2(char Value);
int GlobalVar1;
char GlobalVar2;
#pragma argsused
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
return 1;
}
void SetGlobalVar1(int Value)
{
GlobalVar1 = Value;
}
void SetGlobalVar2(char Value)
{
GlobalVar2 = Value;
}
</pre>
das programm ist nun im vordergrund (auf dem desktop), lädt die dll, sucht sich die functionen raus und ruft zb SetGlobalVar1(14) auf. dann hat GlobalVar1 den wert 14. wenn das jetzt so bleiben würde, wär alles gut. aber es bleibt nicht so, denn sobald das programmm nicht mehr im vordergrund ist, haben alle variablen den wert null (GlobalVar1 = 0, GlobalVar2 = 0). wenn das programm wieder in den vordergrund kommt, werden die alten werte wieder hergestellt. und ich hab absolut keine ahnung, warum das nicht functioniert!
ich wär extreeem dankbar, wenn mir jemand hilft. ich hab desswegen schon zwei tage verbracht (weil ich erst nicht wusste, das die vars auf null gesetz werden... und dachte desswegen, da sind imma irgendwelche fehler)
und vielleicht kann mir ja auch noch jemand sagen, ob man aus der dll eine function vom programm aufrufen kann (wenn man der dll während des laufens die addresse der function sagt).
bitte bitte bitte helft mir
thx sandman
Comment