Q:

How show a Form of a dll file from console application?

I have a dll that contains several Forms. 
I have a reference to main function in Console Aplication that loads this dll.
Then, my trouble is that when executes the function of dll, the Form don't appears and execution of dll file and load.exe (Console Application that calls this dll) both are finalizeds respectivally.
So, how solve this trouble?
Here is my code:
Dll (main part)
library DLL;

uses
  System.SysUtils,
  Connect,
  Classes;

{$R *.res}

procedure ShowDllForm;stdcall;
begin
  Form1 :=TForm1.Create(nil);
  Form1.Show;
end;

exports
 ShowDllForm;

begin
end.

Console Application (load.exe) (calling this dll file) 
var
  Msg: TMsg;

  procedure ShowDllForm;stdcall;
    external 'DLL.dll' name 'ShowDllForm';

begin
 CoInitialize(nil);

  ShowDllForm;

while integer(GetMessage(Msg, 0, 0, 0)) = 0 do begin
    TranslateMessage(Msg);
    DispatchMessage(Msg);
  end;

 CoUninitialize;
end.

And also, if possible, I want know how execute a main Form in dll file in hidden mode.

A:

Your message loop terminates immediately. A value of 0 is returned when WM_QUIT is processed. So the loop will never be entered.  The meaning of the return value is stated clearly in the documentation. 
The message loop should be:
while GetMessage(Msg, 0, 0, 0) do begin
  TranslateMessage(Msg);
  DispatchMessage(Msg);
end;

A non-zero value returned by GetMessage means that there is a message to be processed and that WM_QUIT has not been processed. 
You'll also need to arrange for the DLL to post a quit message when the form closes if you want the process to terminate. 
Even so, this may have problems. The VCL expects messages to be pumped by VCL code. There will likely be odd glitches. If it were me I'd place the message loop in the DLL code. In fact, I suggest calling ShowModal there and removing the message loop from the host. 
procedure ShowDllForm; stdcall;
begin
  Form1 := TForm1.Create(nil);
  try
    Form1.ShowModal;
  finally
    FreeAndNil(Form1);
  end;
end;

And the host can just call the function and have no need for a message loop. Because ShowModal runs a modal message loop. 

