안녕하세요..
dll 에 폼을 넣어 동적으로 부릅니다.
근데 모달폼(ShowModal)의 경우는 문제가 없는데 Show 일 경우에는
무한 에러(? 도저히 종료할수 없는 에러)가 뜹니다.
코드는 아래와 같습니다.
dll의 코드는 아래와 같습니다.
procedure ShowHistory; stdcall;
begin
with TFormHistory.Create(nil) do
begin
try
ShowModal;
finally
Free;
end;
end;
end;
exports
ShowHistory;
begin
end.
프로그램에서 부르는 부분은
type
TShowHistory=Procedure; stdcall;
EDLLLoadError=Class(Exception);
로 선언해놓고
procedure TFormMain.ToolButtonHistoryClick(Sender: TObject);
var
DLLHandle:THandle;
ShowHistory:TShowHistory;
FPointer:TFarProc;
ReturnValue:String;
begin
DLLHandle:=LoadLibrary('iSlipHS.dll');
if DLLHandle>0 then
try
FPointer:=GetProcAddress(DLLHandle,pChar('ShowHistory'));
if FPointer<>nil then
begin
ShowHistory:=TShowHistory(FPointer);
ShowHistory;
end
else
begin
ShowMessage('iSlipHS.dll 이 손상되었습니다.');
end;
finally
FreeLibrary(DLLHandle);
end
else
ShowMessage('iSlipHS.dll을 찾을수 없습니다.');
ReadIniFile;
end;
이렇게 부릅니다.
dll 의 try finally 문에 있는 ShowModal 을
try except 로 바꾸고 Show 를 하면
정확히 어떤 에런지 알수없는 문제가 생깁니다.
다른 분들은 어떻게 사용하시는지 궁금합니다.
아시는 분은 좀 도와주세요..