uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Winsock, StdCtrls, ExtCtrls, Menus ,clipbrd;function LocalIP : string;
type
TaPInAddr = array [0..10] of PInAddr;
PaPInAddr = ^TaPInAddr;
var
phe : PHostEnt;
pptr : PaPInAddr;
Buffer : array [0..63] of char;
I : Integer;
GInitData : TWSADATA;begin
WSAStartup($101, GInitData);
Result := '';
GetHostName(Buffer, SizeOf(Buffer));
phe :=GetHostByName(buffer);
if phe = nil then Exit;
pptr := PaPInAddr(Phe^.h_addr_list);
I := 0;
while pptr^[I] <> nil do begin
result:=StrPas(inet_ntoa(pptr^[I]^));
Inc(I);
end;
WSACleanup;
end;
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Winsock, StdCtrls, ExtCtrls, Menus ,clipbrd;function LocalIP : string;
type
TaPInAddr = array [0..10] of PInAddr;
PaPInAddr = ^TaPInAddr;
var
phe : PHostEnt;
pptr : PaPInAddr;
Buffer : array [0..63] of char;
I : Integer;
GInitData : TWSADATA;begin
WSAStartup($101, GInitData);
Result := '';
GetHostName(Buffer, SizeOf(Buffer));
phe :=GetHostByName(buffer);
if phe = nil then Exit;
pptr := PaPInAddr(Phe^.h_addr_list);
I := 0;
while pptr^[I] <> nil do begin
result:=StrPas(inet_ntoa(pptr^[I]^));
Inc(I);
end;
WSACleanup;
end;
解决方案 »
- 怎样使label穿透?
- 怎么取得ActionList1.Actions[i]的caption ?
- INI文件操作的问题
- 使用TWebBrowser时候怎么忽略所打开的网页链接中的target="_blank"之类属性
- 一个简单的查询语句
- 关于Socket问题
- 打印问题,请高手一定帮我忙!!!!
- 怎样将adoquery1查询的数据转换成EXCEL里呢?望大虾进来帮忙!
- l want to change a specified char to another specified char in a string,but which function can do it? help me pls!
- 菜鸟发难6:哪位大侠给俺们菜鸟说说强制类转换和错误处理!!我我我我,我给他两个现大洋!
- Delphi中直接用Api写程序
- 救命!!四个需求不明确的系统需要多少开发周期?
procedure TFrmInternetDemo.Button1Click(Sender: TObject);
begin
if InetIsOffline(0) then
ShowMessage('This computer is not connected to Internet!')
else
ShowMessage('You are connected to Internet!');
end;