起步软件技术论坛-X3

 找回密码
 立即注册
搜索
查看: 324|回复: 4

【搞定】平台中如何取本机 IP 地址**

[复制链接]
发表于 2007-5-18 10:47:32 | 显示全部楼层 |阅读模式
除了用 WinSock API ,平台中有没有简单的办法?
回复

使用道具 举报

 楼主| 发表于 2007-5-18 14:17:07 | 显示全部楼层
都哪里去了?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-5-18 15:16:30 | 显示全部楼层
我还在等着呢,有没有简单的办法阿,没有的话我就用 API 取了,回答一次巴!
回复 支持 反对

使用道具 举报

发表于 2007-5-18 15:30:20 | 显示全部楼层
NameSpace: Business.System
--------------------------------------------------------------------------------
JSSysUtils = class(System.Object)
public
  cInvalidFileNameChar: string;
  static procedure CheckFileExists;
  static procedure ClearDirectory(ADirectory: string; ADel: Boolean; AInclude: Boolean);
  static function ConfigFileName: string;
  static function ConvertUnits(Value: Longint; InUnits: TUnits; OutUnits: TUnits; DPI: Longint): Longint;
  static function CopyStr(AString: string; ACount: Longint): string;
  static function DeleteLastChar(AStr: string): string;
  static procedure DeleteRegKey(ARootKey: Longword; Key: string);
  static procedure DeleteRegValue(ARootKey: Longword; Key: string; Name: string);
  static procedure DeleteRegValues(ARootKey: Longword; Key: string);
  static function EJBDataTransferIsXMLMode: Boolean;
  static function EnableProcessPrivilege(Enable: Boolean; Privilege: string): Boolean;
  static function EqualStream(AStream1: TStream; AStream2: TStream): Boolean;
  static function ExtractOnlyFileName(FileName: string): string;
  static function ExtractOnlyFullFileName(FileName: string): string;
  static function FormatAndUniteStr(Splitter: string; ItemFormat: string; AStrings: TStrings): string;
  static function FormatAndUniteStrEx(Splitter: string; ItemFormat: string; AStringsArray: array of TStrings): string;
  static function GetComputerIP(AComputerName: string): Longword;
  static procedure GetComputerIPs(AComputerName: string; IPs: TList);
  static function GetComputerIPStr(AComputerName: string): string;
  static procedure GetComputerIPStrs(AComputerName: string; IPs: TStrings);
  static function GetComputerName: string;
  static function GetDBIniPath: string;
  static function GetDirectParentForm(Control: Business.Forms.TControl): Business.Forms.TCustomForm;
  static function GetFileExt(FileName: string): string;
  static function GetFileIconDesc(FileName: string; IconFile: string; IconIndex: Longint): Boolean;
  static function GetFileTypeName(FileName: string): string;
  static function GetIORByURL(AURL: string): string;
  static function GetJavaVMClassPath: string;
  static function GetLocalIP: Longword;
  static function GetLocalIPStr: string;

  static function GetSystemDir: string;
  static function GetSystemTempPath: string;
  static procedure GetUserInfo(AUsername: string; ACompany: string);
  static function GetUserName: string;
  static function GetValidIdent(Ident: string): string;
  static function GetWindowsDir: string;
  static function IIf(TestValue: Boolean; TrueValue: TObject; FalseValue: TObject): TObject;
  static function IsDriver(APathName: string): Boolean;
  static function IsValidFileName(AFileName: string): Boolean;
  static procedure LoadPackages(Section: string);
  static function MillimeterToPixel(Value: Longint; DPI: Longint): Longint;
  static function Num2CNum(ArabicNumber: Double; ACNumKind: TCNumKind): string;
  static function PixelToMillimeter(Value: Longint; DPI: Longint): Longint;
  static function ReadIniStr(AFile: string; ASec: string; AId: string; ADefaultValue: string): string;
  static function ReadRegBool(ARootKey: Longword; Key: string; Name: string; DefaultValue: Boolean): Boolean;
  static function ReadRegInteger(ARootKey: Longword; Key: string; Name: string; DefaultValue: Longint): Longint;
  static function ReadRegString(ARootKey: Longword; Key: string; Name: string; DefaultValue: string): string;
  static procedure ReadRegValues(ARootKey: Longword; Key: string; Values: TStrings); overload;
  static procedure ReadRegValues(ARootKey: Longword; Key: string; Names: TStrings; Values: TObject); overload;
  static function ReadServerURL(Section: string): string;
  static function RequestTempFile(PathName: string; PrefixStr: string; UniqueID: Longint): string;
  static function RoundEx(X: Double; Scale: Word): Double;
  static procedure ShellLockOpenStream(AStream: TStream; FileName: string; Operation: string);
  static procedure ShellOpenStream(AStream: TStream; FileName: string; Operation: string; Proc: to do; ProcParams: TObject);
  static function SplitChildName(AString: string): string;
  static procedure SplitExprStrings(Source: TStrings; Names: TStrings; Values: TStrings);
  static procedure SplitParentChild(AString: string; AParentName: string; AChildName: string);
  static function SplitParentName(AString: string): string;
  static function StringsToFilter(Strings: TStrings): string;
  static function StringsToTerm(AStrList: TStrings): string;
  static function SubStrReplace(S: string; AStartPos: Longint; ALength: Longint; NewParten: string): string;
  static function TruncEx(X: Double; Scale: Word): Double;
  static procedure UniteExprStrings(Dest: TStrings; Names: TStrings; Values: TStrings);
  static function UniteStrEx(Splitter: string; AStringsArray: array of TStrings; CallBack: to do): string;
  static function UnQuoteStr(AString: string): string;
  static function URLIsCORBAType(AURL: string): Boolean;
  static function Win32ExecAndWait(Cmd: string; CmdShow: Longint; ProcessMessages: to do): Longword;
  static procedure Win32RunExe(CmdLine: string; CmdShow: Longint); overload;
  static procedure Win32RunExe(CmdLine: string); overload;
  static function WinExec32AndWait(Cmd: string; CmdShow: Longint): Longword;
  static procedure WriteRegBool(ARootKey: Longword; Key: string; Name: string; Value: Boolean);
  static procedure WriteRegInteger(ARootKey: Longword; Key: string; Name: string; Value: Longint);
  static procedure WriteRegString(ARootKey: Longword; Key: string; Name: string; Value: string);
  static procedure WriteRegValues(ARootKey: Longword; Key: string; Names: TStrings; Values: array of TObject);
  property DefaultConfigPath: string;
end;
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-5-18 16:00:06 | 显示全部楼层
太好了,谢谢 alang !
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Justep Inc.

GMT+8, 2025-1-10 12:04 , Processed in 0.040119 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表