On Thu, Nov 27, 2008 at 3:28 PM, Dave Coventry <[EMAIL PROTECTED]> wrote: > > I'm trying to get the name of the computer my app is running on. > > I've tried this:
We use the following in tiOPF for Delphi and FPC. ------------------------------------------------------ function tiGetComputerName : string; begin {$IFDEF MSWINDOWS} Result := tiWin32GetComputerName; {$ENDIF MSWINDOWS} {$IFDEF UNIX} Result := tiUnixGetComputerName; {$ENDIF UNIX} end; --------------------------------------------- uses unix; function tiUnixGetComputerName: string; begin Result := GetHostName; end; -------------------------------------------- uses Windows; function tiWin32GetComputerName: string; var computerNameBuffer: array[0..255] of char; sizeBuffer: DWord; begin SizeBuffer := 256; getComputerName(computerNameBuffer, sizeBuffer); result := string(computerNameBuffer); end; ------------------------------------------------------ Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/ _______________________________________________ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus