폼 구성은 DLL 을 호출하는 폼과 호출되는 폼이 있습니다.
그런데 호출되는 폼은 모달폼이 아닌 모달리스 폼입니다..
var
LibHandle : THandle;
ShowQOrder : TShowQOrder;
Arg : ShortString;
iHandle : Integer;
begin
Arg := '';
LibHandle := LoadLibrary('KKKQuickOrder.dll');
@ShowQOrder := GetProcAddress(LibHandle, 'ShowQOrder');
if not (@ShowQOrder = nil) then
ShowQOrder(Application.Handle, Self.Width, Self.Height, BottomBasePnl.Height, Arg, LibHandle);
위와같이 LibHandle로 자신의 핸들값을 가집니다.
그리구 DLL 폼이 죽을때 Postmessage 를 보내서
PostMessage(FindWindow('TMainFrm',nil),WM_USER + 7778 ,0,LibHandle);
일케 핸들값을 보내서 Free 시킵니다....
근데 오널까지만해두 에러없이 잘 Free 되던것이...
오널 다른 Dll을 추가하니(다른 작업두 같이) 둘다 에러가 나네요...
왜 그럴까요?? 아무리 인자값.. 을 봐두 잘못된게 없는데...
아.. 참고적으루 전 DLL 폼을 죽이지않고.. 그냥 호출한 폼에서
프리 시킬때까지 기다립니다...
그러니.. 폼이 없어지자마자 아래와 같은 에러가 나네요..
답변 좀 부탁드립니다...
에러 메세지 :
Project Stock.exe raised exception class EAccess Violation with
message 'Acces violation at address 4005B0A2 in module 'Vcl50.bpl'.
Read of address ......