위 그림처럼 똑 같은 dll 을 삽입했습니다..
DLL 삽입 을 누루고
데이타입력 버튼을 눌러서 두 화면에 값을 넣고 싶은데..
데이타입력 버튼을 누르면 나중에 삽입한 DLL삽입 2 에만 값이 들어갑니다...
DLL삽입 1 에도 값이 들어가게 할수는 없나요 ?
아래는 소스 내용입니다..
===================================================================================
Dll source
===================================================================================
// Dll 삽입
procedure ShowTestDlg(App:TApplication; Parent:TWinControl) ; export;
begin
Application := App;
frmMain := TfrmMain.Create(App);
frmMain.BorderStyle := bsNone;
frmMain.Align := alClient;
frmMain.Parent := Parent;
frmMain.Show;
end;
// 데이타입력
procedure strInfo(gubun:String); export;
begin
frmMain.Edit1.Text := gubun ;
end;
exports
ShowTestDlg, strInfo ;
===================================================================================
Exe source
===================================================================================
var
Form1: TForm1;
iDllHandle, iDllHandle2 : integer; // Dll 핸들 변수
implementation
// Dll 삽입
procedure TForm1.Button4Click(Sender: TObject);
var
DllFunc, DllFunc2 : procedure (App:TApplication; Parent:TWinControl);
begin
iDllHandle := LoadLibrary('test_01.DLL');
iDllHandle2 := LoadLibrary('test_01.DLL');
if iDllHandle >= 32 then begin
@DllFunc := GetProcAddress(iDllHandle, 'ShowTestDlg');
if @DllFunc <> Nil then
DllFunc(Application, Panel1);
end;
if iDllHandle2 >= 32 then begin
@DllFunc2 := GetProcAddress(iDllHandle2, 'ShowTestDlg');
if @DllFunc2 <> Nil then
DllFunc(Application, Panel2);
end;
end;
// 데이타 입력
procedure TForm1.Button1Click(Sender: TObject);
var DllVal, DllVal2 : procedure (gubun:string);
begin
if iDllHandle >= 32 then begin
@DllVal := GetProcAddress(iDllHandle, 'strInfo');
if @DllVal <> Nil then
DllVal('01');
end;
if iDllHandle2 >= 32 then begin
@DllVal2 := GetProcAddress(iDllHandle2, 'strInfo');
if @DllVal2 <> Nil then
DllVal2('02');
end;
end;
procedure ShowTestDlg(App:TApplication; Parent:TWinControl) ; export;
begin
Application := App;
Mainfrm := TfrmMain.Create(App);
Mainfrm.BorderStyle := bsNone;
Mainfrm.Align := alClient;
Mainfrm.Parent := Parent;
Mainfrm.Show;
end;
procedure strInfo(gubun:String); export;
begin
if Assigned(Mainfrm) then
Mainfrm.Edit1.Text := gubun ;
end;
이렇게 해도 마찬가지 결과가 나오나요? ^^;