---------------------------------------------------------------
个人资料简介uses Windows, WinSock;
{ ComputerLocalIP }
//取本机的 IP 地址
function ComputerLocalIP: string;
var
ch: array[1..32] of char;
wsData: TWSAData;
myHost: PHostEnt;
i: integer;
begin
Result := '';
var
ch: array[1..32] of char;
wsData: TWSAData;
myHost: PHostEnt;
i: integer;
begin
Result := '';
if WSAstartup(2,wsData)<>0 then Exit; // can’t start winsock
try
if GetHostName(@ch[1],32)<>0 then Exit; // getHostName failed
except
Exit;
end;
myHost := GetHostByName(@ch[1]); // GetHostName error
if myHost=nil then exit;
for i:=1 to 4 do
begin北京现代伊兰特油耗
Result := Result + IntToStr(Ord(myHost.h_addr^[i-1]));
if i<4 then
Result := Result + '.';
end;
end;
try
if GetHostName(@ch[1],32)<>0 then Exit; // getHostName failed
except
Exit;
end;
myHost := GetHostByName(@ch[1]); // GetHostName error
if myHost=nil then exit;
for i:=1 to 4 do
begin北京现代伊兰特油耗
Result := Result + IntToStr(Ord(myHost.h_addr^[i-1]));
if i<4 then
Result := Result + '.';
end;
end;
/
/获取本机IP的MAC地址
Function GetMacAddress: string;
var
Lib: Cardinal;起泡胶无胶水怎么做
Func: function(GUID: PGUID): Longint; stdcall;
GUID1, GUID2: TGUID;
begin
Result := '';
Lib := LoadLibrary('rpcrt4.dll');
if Lib <> 0 then
begin
if Win32Platform <>VER_PLATFORM_WIN32_NT then
@Func := GetProcAddress(Lib, 'UuidCreate')
else @Func := GetProcAddress(Lib, 'UuidCreateSequential');
if Assigned(Func) then
var
Lib: Cardinal;起泡胶无胶水怎么做
Func: function(GUID: PGUID): Longint; stdcall;
GUID1, GUID2: TGUID;
begin
Result := '';
Lib := LoadLibrary('rpcrt4.dll');
if Lib <> 0 then
begin
if Win32Platform <>VER_PLATFORM_WIN32_NT then
@Func := GetProcAddress(Lib, 'UuidCreate')
else @Func := GetProcAddress(Lib, 'UuidCreateSequential');
if Assigned(Func) then
begin
if (Func(@GUID1) = 0) and
(Func(@GUID2) = 0) and
(GUID1.D4[2] = GUID2.D4[2]) and
(GUID1.D4[3] = GUID2.D4[3]) and
(GUID1.D4[4] = GUID2.D4[4]) and
(GUID1.D4[5] = GUID2.D4[5]) and
(GUID1.D4[6] = GUID2.D4[6]) and
(GUID1.D4[7] = GUID2.D4[7]) then
begin
Result :=
IntToHex(GUID1.D4[2], 2) +'-' +
IntToHex(GUID1.D4[3], 2) + '-' +
IntToHex(GUID1.D4[4], 2) + '-' +
记一次游戏四年级作文 IntToHex(GUID1.D4[5], 2) + '-' +
if (Func(@GUID1) = 0) and
(Func(@GUID2) = 0) and
(GUID1.D4[2] = GUID2.D4[2]) and
(GUID1.D4[3] = GUID2.D4[3]) and
(GUID1.D4[4] = GUID2.D4[4]) and
(GUID1.D4[5] = GUID2.D4[5]) and
(GUID1.D4[6] = GUID2.D4[6]) and
(GUID1.D4[7] = GUID2.D4[7]) then
begin
Result :=
IntToHex(GUID1.D4[2], 2) +'-' +
IntToHex(GUID1.D4[3], 2) + '-' +
IntToHex(GUID1.D4[4], 2) + '-' +
记一次游戏四年级作文 IntToHex(GUID1.D4[5], 2) + '-' +
IntToHex(GUID1.D4[6], 2) + '-' +
IntToHex(GUID1.D4[7], 2);
end;
end;
FreeLibrary(Lib);
end;
end;
IntToHex(GUID1.D4[7], 2);
end;
end;
FreeLibrary(Lib);
end;
end;
//取本机的计算机名
{ ComputerName }
function ComputerName: string;
var
FStr: PChar;
FSize: Cardinal;
begin
var
FStr: PChar;
FSize: Cardinal;
begin
FSize := 255;
GetMem(FStr, FSize);
Windows.GetComputerName(FStr, FSize);
Result := FStr;
FreeMem(FStr);
end;
GetMem(FStr, FSize);
Windows.GetComputerName(FStr, FSize);
Result := FStr;
FreeMem(FStr);
end;
//取Windows登录用户名
{ WinUserName }
function WinUserName: string;
var
FStr: PChar;
FSize: Cardinal;
begin贾乃亮主演的电视剧
FSize := 255;
var
FStr: PChar;
FSize: Cardinal;
begin贾乃亮主演的电视剧
FSize := 255;
GetMem(FStr, FSize);
GetUserName(FStr, FSize);
Result := FStr;
FreeMem(FStr);
end;
GetUserName(FStr, FSize);
Result := FStr;
FreeMem(FStr);
end;
发布评论