<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">By the way,<br><br>I was always wondering why there is not TUser object and no TComputer.<br><br>For example:<br><br>   TUser.SettingsPath<br>   TUser.LoginID<br>   TUser.Surname<br>   TUser.Firstname<br><br>and so on.<br><br>And<br><br>  TComputer.CurrentUser<br>  TComputer.Name<br>  TComputer.SettingsPath<br><br>Or does this exist already ?<br><br>I only know TApplication and TScreen so far.<br><br>Regards,<br>Sam<br><br>--- Martin Friebe <i><lazarus@mfriebe.de></i> schrieb am <b>Sa, 20.6.2009:<br></b><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><b><br>Von: Martin Friebe <lazarus@mfriebe.de><br>Betreff: Re: [Lazarus] Some thoughts about the global 'Application' instance.<br>An: "Lazarus mailing list"
 <lazarus@lists.lazarus.freepascal.org><br>Datum: Samstag, 20. Juni 2009, 16:11<br><br></b><div class="plainMail"><b>Joost van der Sluis wrote:<br>> Hi all,<br>> <br>> I always thought that an application always had one Application-instance<br>> from the TCustomAppliction class. But at this moment this is not the<br>> case for fcl-web applications, or daemon-applications which are using<br>> Lazarus-forms.<br>> <br>> Take for example the fpcgi unit from fcl-web. (not the old one from<br>> Lazarus) There a global variable Application is defined and initialized<br>> and finalized. This Application should be used throughout the program.<br>> <br>> But nowadays we are forced to include the 'interfaces' unit, which uses<br>> the 'forms' unit which has it's own global Application variable. So<br>> there are two TCustomApplication descdendents initialized during the<br>>
 program!<br>>   <br>Hm, following the thread, there are various ideas, how the case of 2 application instances should/could be avoided. And would be avoided in an automatic (forceful) manner.<br>The range from:<br>- Replacing Application variable by a function, or even unit<br>- depended initialization of Forms.Application (only if no other app...)<br><br>Now for a start let's ignore the fact that Interfaces forces us to use the Forms unit. (This is a problem of it's own, which can be fixed with a moderate (or less) amount of work (imho).<br><br>If a program uses both Forms and fcl-web (or any combination of 2 or more units having an application), how should those units know which application is used?<br>More so, how does anyone but the author of the program now, that only one is used?<br><br>Example: I may write a cgi-application (therefore it must have the web-fcl CgiApplication, right?), but I want to use this app to report the
 current screen resolution on the Server, so I do want to access the Screen object from the forms unit, which uses the application instance from the forms unit (and probably would not work weel, with an cgiApplication instance?)<br>So there may  be cases where more than one instance of different classes of Application is required.<br><br>The best way to avoid it, is or the author of the program only to use units that do not instantiate an application, other than the one(s) needed.<br><br>This brings me back to the original problem:<br>1) being forced to use Interfaces<br>2) Intefaces using Forms<br><br>2: can be solved: I wrote another mail on that.<br><br>1: can be looked at. You are forced to use interfaces, if you use anything that needs to access the widgetsets (btw, in which case you are likely (but only likely) to need the Forms.application).<br>If your code does not access any widgetsets then you shouldn't be forced to use interfaces. If you
 use a unit containing such code, but don't need the the particular bit of code, you must use smartlinking, or the code is included.<br>Otherwise, ther may be a case to find out why and what is using the widgetsets.<br><br>Best Regards<br>Martin<br><br><br>--<br>_______________________________________________<br>Lazarus mailing list<br><a ymailto="mailto:Lazarus@lists.lazarus.freepascal.org" href="/mc/compose?to=Lazarus@lists.lazarus.freepascal.org">Lazarus@lists.lazarus.freepascal.org</a><br><a href="http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus" target="_blank">http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus</a><br></b></div></blockquote></td></tr></table><br>