Displaying Modeless Forms from DLLs

To illustrate placing modeless forms in a DLL, we'll use the same calendar form as the previous section.

When displaying modeless forms from a DLL, the DLL must provide two routines. The first routine must take care of creating and displaying the form. A second routine is required to free the form. Listing 6.4 displays the source code for the illustration of a modeless form in a DLL.

Listing 6.4. A Modeless Form in a DLL
unit DLLFrm; interface uses SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls, Forms, Dialogs, Grids, Calendar; type TDLLForm = class(TForm) calDllCalendar: TCalendar; end; { Declare the export function } function ShowCalendar(AHandle: THandle; ACaption: String): Longint; ...

Get Borland® Delphi™ 6 Developer's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.