Form이 한개인 경우는 게시판에 예제가 잘 나와 있어서 구현이 쉬웠지만,
Form이 두개인 경우는 어떻게 해야 하나요???
예를 들면, DLL로 만든 ChildMdil Form1이 Form2를 생성하는 건데요??
잘 안되네요..
Dll 프로젝트에서 어떤 행위를 해줘야 하나요?
참고로, Form2는 프린트폼으로 쓰려고 합니다.
아래는 프로젝트 소스 예제입니다.
library SCR_GODTR;
{ Important note about DLL memory management: ShareMem must be the
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }
uses
SysUtils,
Windows,
Forms,
Classes,
SAGOD_OUT in 'SAGOD_OUT.pas' {Form1},
Unit2 in 'Unit2.pas' {Form2};
{$R *.RES}
var
DllApplication: TApplication;
procedure ProcChild(ParentApplication: TApplication; ParentForm: TForm); export; stdcall;
var
Form1: TForm1;
begin
Application := ParentApplication; //넘겨받은 어플리케이션 할당함
Form1 := TForm1.Create(ParentForm);
Form1.Show;
end;
procedure DLLUnloadProc(Reason: Integer); register;
begin
if Reason = DLL_PROCESS_DETACH then
Application := DllApplication; //Dll 종료(?)시 어플리케이션을 원상태로 돌림.
end;
exports
ProcChild;
begin
DllApplication := Application;
DllProc := @DLLUnloadProc;
end.