dxTabbedMDIManager + DLL窗体 出错问题
li_sj 2013-05-10 10:38:44 使用Dev dxTabbedMDIManager控件使用MDI窗口显示在TAB页面,主程序中的Mdi窗口显示没有问题,但DLL封装的Mdi窗口则出错。
有谁碰到过,指点一下
MDIForm
type
TProc = procedure(MyApplication: TApplication; MyParent: TForm); stdcall;
……
var
formMain: TformMain;
th: THandle;
implementation
{$R *.dfm}
procedure TformMain.ReadDLLForm(sDLLHandle: PWideChar;Parent:PAnsiChar) ;
var
tp: TProc;
label isLoad;
begin
isLoad:
if th <= 0 then
begin
th := LoadLibrary(sDLLHandle);
goto isLoad;
end
else
@tp := GetProcAddress(th, Parent);
if @tp <> nil then
tp(Application, Self);
end;
initialization
finalization
if th > 0 then
FreeLibrary(th);
end.
MDIChild
……
{$R *.res}
var
DLLApp: TApplication;
procedure CreateDLL_formSalesList(App: TApplication; MyParent: TForm); stdcall;
begin
Application := App;
formSalesList := TformSalesList.Create(MyParent);
end;
procedure DllUnload(Resean: Word); register;
begin
if Resean = DLL_PROCESS_DETACH then
Application := DLLApp;
end;
exports CreateDLL_formSalesList;
begin
DLLApp := Application;
DllProc := @DllUnload;
end.