Re: Call EXE from DLL (A crystal User defined DLL)
On 7 Nov, 19:20, Joseph M. Newcomer <newco...@flounder.com> wrote:
Another solution besides the callback is to pass an HWND and have your DLL SendMessage or
PostMessage to the HWND.
Yes, thought of that, but in the end I did this:
Main app does a LoadLibrary on the Crystal DLL and:
Kilroy = (Kilroy_type)GetProcAddress(hDLL, "Kilroy");
if(Kilroy)
{
(*Kilroy)(1,(FARPROC)&CLpKalender::crBeraknaSemesterdagar);
(*Kilroy)(2,(FARPROC)&CLpKalender::crBeraknaArbetsdagar);
}
}
Thus passing the addresses of the needed functions to the DLL, which
stores them globally:
// http://support.microsoft.com/kb/125677
//
#pragma comment(linker, "/SECTION:.shared,RWS")
#pragma data_seg( ".shared" )
FARPROC crBeraknaSemesterdagar = NULL;
FARPROC crBeraknaArbetsdagar = NULL;
#pragma data_seg()
Then the User-defined fn in the dll, just does a:
if(crBeraknaSemesterdagar)
ret = (crBeraknaSemesterdagar)(FirstParam->Parameter.ParamString,
SecondParam->Parameter.ParamString