Am 24.04.2012 18:25, schrieb Jürgen Hestermann:
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.
This specific exception could be the result of a SysErrorMessage(GetLastOSError) which on Windows uses the routines of Windows to translate the error and thus will be in the language your OS is setup for. (Note: this is a guess, but maybe a very valid one ;) )
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?
As you are using LCL functions it would be better if you ask such things on the Lazarus list.
Regards, Sven _______________________________________________ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
