// Call CoCreateGuid. The last six bytes are equal to the mac address of
// the Ethernet card. (Note that if you have more than one NIC in your
// computer, you'll get the mac address of one of them, but you can't
// easily control which one.)
// Sneeky... I like it! This will work quite neatly on systems without an
// ethernet card as well. AFAIK this part of the GUID is constant even if you
// only have PPP or even no-networking installed. A useful source of machine
// unique IDs...makes you wonder what the fuss about the PIII ID was about(not
// that I think it's a good idea ;)
// Tip: 델파이 IDE에서 Ctrl-Shift-G 를 눌러보세요...
// GUID가 생성 되는데 뒤에 6바이트(2자리씩 12글자) 는 네트워크 환경이
// 있다면 mac-address 와 같습니다
// PPP or even no-networking
function GetNicAddr: AnsiString;
const
GUID_MAX = 72;
var
guid: TGuid;
buf: array[0..GUID_MAX] of WideChar;
begin
CoCreateGuid(@guid);
StringFromGUID2(guid, buf, GUID_MAX);
Result := Copy(WideCharToString(buf),26,12);
end;
'델파이' 카테고리의 다른 글
[델파이] IP Helper API 를 이용한 "ipconfig /all" 구현 (0) | 2019.10.04 |
---|---|
[델파이] IP Helper API 를 이용한 ARP 예제 (mac->IP 구하기) (0) | 2019.10.04 |
[델파이] 델파이에서 사용되는 정수형 변수들 (0) | 2019.10.02 |
[델파이] 프로세스 우선순위 올리기 (0) | 2019.10.02 |
[델파이] 델파이 실행파일 Virus.Win32.Induc.a 감염 해결방법 (0) | 2019.10.01 |