I develop a dll with the form and TElTreeStringGrid, cannot use never freelibrary, because the program freeze to end, 100% CPU used, i used C++ Builder XE Update 3.
UnicodeString strFilePath = ExtractFilePath( Application->ExeName ) + "CGuestDLL.dll";
CGuestDLLHandle = LoadLibraryW( strFilePath.c_str() );
if ( CGuestDLLHandle != 0 ) {
TFunction_showform ShowForm = (TFunction_showform)GetProcAddress( CGuestDLLHandle, "ShowForm" );
ShowForm();
FreeLibrary( CGuestDLLHandle ); //<---- Cannot use the program freeze to unload/end 100% CPU Used
}
else {
Application->MessageBoxW( L"Fail", L"Fail", MB_OK );
};
My DLL Show Form is the next
__declspec (dllexport) void __stdcall ShowForm( void ) {
TfrmGrid *frmGrid;
Application->CreateForm( __classid( TfrmGrid ), &frmGrid );
frmGrid->ShowModal();
delete frmGrid;
}
For test propuses frmGrid Is Only TElTreeStringGrid no buttons nothing, Try with TElTree and same result.
Sorry For the bad english.
Comments
//Add the lines to end of delete frmGrid;
//Clear LMD theme services globals vars
TLMDThemeServices *_LMDThemeServices = LMDThemeServices();
delete _LMDThemeServices;
TThemeServices *_ThemeServices = ThemeServices();
delete _ThemeServices;