Function の使い方

解決


吉沢正太郎  2010-02-26 05:07:37  No: 37771

マックアドレス取得方法を調べていたら以下のような方法を発見したのですが使用方法がわかりません、Functionとなっているのですがコレを用いFORM1のEdit1の中に代入したいと思います。

方法を教えていただきたいです。

Uses Winsock;

Function SendARP (DestIp: DWORD; srcIP: DWORD; pMacAddr: pointer; PhyAddrLen: Pointer): DWORD;stdcall; external 'iphlpapi.dll';

Function getRemoteMacAdress (var address: String): Boolean;
var
  dwRemoteIP: DWORD;
  PhyAddrLen: Longword;
  pMacAddr : array [0..1] of Longword;
  temp: array [0..5] of byte;
  I: Byte;
begin
  Result := false;
  dwremoteIP := inet_addr (@address[1]);
  if dwremoteIP <> 0 then begin
    PhyAddrLen := 6;
    if SendARP (dwremoteIP, 0, @pMacAddr, @PhyAddrLen) = NO_ERROR then begin
      if (PhyAddrLen <> 0) and (pMacAddr[0] <> 0) then begin
         Move (pMacAddr, temp, 6);
         address := '';
         For I := 0 to 5 do address := address + inttohex (temp[i], 2)+'-';
         Delete (address, Length (address), 1);
         Result := true;
      end;
    end;
  end;
end;


吉沢正太郎  2010-02-26 06:02:44  No: 37772

自己解決いたしました。


※返信する前に利用規約をご確認ください。

※Google reCAPTCHA認証からCloudflare Turnstile認証へ変更しました。






  このエントリーをはてなブックマークに追加