Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Problems to use TElTreeStringGrid And DLL

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

  • 3 Comments sorted by Votes Date Added
  • Problem Solved in C++ Builder XE Update 3

    //Add the lines to end of delete frmGrid;
    //Clear LMD theme services globals vars

     TLMDThemeServices *_LMDThemeServices = LMDThemeServices();

      delete _LMDThemeServices;

      TThemeServices *_ThemeServices = ThemeServices();

      delete _ThemeServices;

  • Hi,

    If it is not crucial to call      FreeLibrary( CGuestDLLHandle );  right after ShowForm();
    then you might move FreeLibrary( CGuestDLLHandle ) call to finalization part, this change must remove issue, too.






Sign In or Register to comment.