Home > Back-end >  EXE calling DLL MDI child form an error occurred when released
EXE calling DLL MDI child form an error occurred when released

Time:10-04

I an EXE, written in c + + Builder2010 EXE will call DLL MDI child forms show in their own MDI form, but every time the Debug to FreeLibrary, will go wrong, check a lot of, still no solution.
The calling code
DLL_File=LoadLibrary (FilePath. T_str ());//DLL__File is defined in an external handle
If (DLL_File!=NULL)
{
TForm * __stdcall DLL_Func (*) (String, TComponent *)=
(TForm * (__stdcall *) (String, TComponent *)) GetProcAddress call (DLL_File, DLL_Entry t_str ());//FLL__Entry DLL entry point
If (DLL_Func!=NULL)
{
FORM=DLL_Func (medt_UserName - & gt; The Text. The Trim (), this);//FORM is defined in the external FORM of pointer
FORM - & gt; Show ();
}
The else
{
ShowMessage (" export function abnormal ");
}
}
The else
{
ShowMessage (" DLL load failed ");
}
DLL code
The entry
TForm extern "C" __declspec (dllexport) * __stdcall Material_Management (String _UserName, TComponent * Owner)
{
Return new Tfrm_Main (Owner, _UserName);//this is directly copied from ccrun to
}

CodePudding user response:

Return new Tfrm_Main (Owner, _UserName);//

Should have a delete release resources.

CodePudding user response:

Frm_Main is an MDI child window, can't delete,

CodePudding user response:

OnClose handling Action=caFree;

CodePudding user response:

This I do
But in an EXE cannot FreeLibrary
I am not FreeLibrary now
The results had no matter

CodePudding user response:

You now this code and you give your code difference is very big, so if there is any problem in your project, not sure,
  • Related