Lazarus DLL can't display a form when called from MFC application
Original Reporter info from Mantis: zex2011
-
Reporter name: Zex Atilla
Original Reporter info from Mantis: zex2011
- Reporter name: Zex Atilla
Description:
When a Lazarus DLL is used from Visual C++ MFC program
(under Windows) the DLL cannot display a form.
In fact, it crashes the main application.
But if the application is made with Visual C++ Win32
(non-MFC) or GCC or Lazarus it works fine.
Source code can be downloaded from:
http://gromada.com/dl/extra/dll_cannot_show_form.zip
- TestDLL - very simple Lazarus DLL with a test function that shows the form (TestProc)
- TestProg - very simple Visual C++ MFC program that calls the test function
The above MFC program (TestProg/Debug/testprog.exe) calls the test function TWO TIMES:
-
Before the main MFC window appears. At that time everything
works and the Lazarus form is displayed correctly. Close it to continue. -
When the MFC main window appears it waits for an user action.
Right-click the title bar of the program and choose "About".
This will again call the DLL function, but this time the function
will crash and take entire program with it.
The crash happens in:
unit Win32WSControls.pp;
function FinishCreateWindow;
line Windows.SendMessage (last line in the function);
Mantis conversion info:
- Mantis ID: 19327
- Version: 0.9.30.1 (SVN)