Hello all,
Could anyone tell me why the DLL_PROCESS_DETACH function below isn't fired by Delphi 6 where it gets fired properly by Delphi5? in fact no reason code is giving, when i unhook the dll, where the Attach gets fired upon loading.
procedure DLLHandler( Reason : INTEGER );
begin
case Reason of
DLL_PROCESS_ATTACH:
begin
end;
DLL_PROCESS_DETACH:
begin
// Your shutdown code goes here...
MessageBox(0,'unloading','',0);
end;
DLL_THREAD_ATTACH:
begin
end;
DLL_THREAD_DETACH:
begin
end;
end;
end;
begin
DLLProc := @DLLHandler;
DLLHandler(DLL_PROCESS_ATTACH);
Basically if the dll is compiled with Delphi 5.0 when i unhook the injected dll i get the Unloading MessageBox, by if i compile in delphi6 i don't get the Unloading Message so in other words i don't think it gets fired at all, which causes my dll to crash because of not being able to cleanup. so if you could please help me fix this so it gets fired every time i unhook the dll.
the dll has nothing but the above code, and still doesn't fire, just recompiled with Delphi 7 and it works.. so now it works on delphi 5 and 7, weired stuff. the only other thing i need to try is to update delphi 6.0, but i can't find the updates on Borlands Site... does anyone know where i can get these updates..
Oh yah i reinstalled delphi6 and no resolution yet, so now i'm installing it on a different machine just to see what happens.
Tried writing to a file and nothing so i know the event isn't fired... what could it be....? i don't rememeber changing anything on the ide setting and even if i did uninstaling and reinstalling delphi 6 should get the settings back to normal, and still no joy...
Thanks, for the link i swear i was at that link and the page kept taking me to Delphi 2005 downloads, anyway installing delphi 6 on another machine didn't fix the problem, let's see what happens after the updates, downloading them now.
Sure enough after the updates, the Unloading Box fires as it should, so in conclusion the Dlephi 6.0 original installation had a bug, there it goes days of testing...
and yes i learned my lesson, always install updates...