[fpc-pascal] Program without window but messages

JC Chu jcchu at acm.org
Tue Apr 24 19:43:39 CEST 2012

Try this.

On April 25, at 00:25, Jürgen Hestermann wrote:

> I wanted to write a program that has no window but may show messages to
> the user.
> I have lots of such programs written with Virtual Pascal but I am
> struggling
> to do the same with Free Pascal/Lazarus.
> A simple test program would look like this:
> --------------------------------
> program Test;
> {$mode objfpc}{$H+}
> uses  Interfaces,Forms,Windows,SysUtils,Dialogs;
> {$R *.res}
> begin
> ShowMessage('TEST');
> end.
> --------------------------------
> When I create a new project and select to create an "Application",
> copy the above into the main program (ignoring Unit1.pas) and run
> the program I get an exception "Fensterklasse nicht gefunden" (in
> german, although I setup Lazarus in english!) and I am put into
> Win32WSControls.
> When I try the same with a new "Program" and use the same test file
> (just omitting Interfaces and Forms units, because Lazarus cannot find it.
> Why? I did find it when creating an "Application")  I cannot even
> compile it because I get:
> project1.lpr(10,12) Error: Identifier not found "ShowMessage"
> The wiki ( http://wiki.freepascal.org/Dialog_Examples/de#ShowMessage )
> says that this function is definied in Dialogs which I included in my
> uses clause. Still it cannot find it. Why is ShowMessage not available?
> Creating a console program is not an option because it will create a
> console window which I don't need.
> Anybody who knows why it is like that?
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Best Regards,
JC Chu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Test.zip
Type: application/x-zip-compressed
Size: 1574 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20120425/50cdf916/attachment.bin>

More information about the fpc-pascal mailing list