Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Cross-Platform-Entwicklung (https://www.delphipraxis.net/91-cross-platform-entwicklung/)
-   -   Comptername und GetMotherBoardSerial für WINDOWS und LINUX (https://www.delphipraxis.net/196585-comptername-und-getmotherboardserial-fuer-windows-und-linux.html)

bernhard_LA 1. Jun 2018 10:44

Comptername und GetMotherBoardSerial für WINDOWS und LINUX
 
ich benötige eine Windows und LINUX kompatible Variante dieser beiden Funktionen


Delphi-Quellcode:
Function GetMotherBoardSerial:string;
var
  WMIServices : ISWbemServices;
  Root       : ISWbemObjectSet;
  Item       : Variant;
begin
  WMIServices := CoSWbemLocator.Create.ConnectServer('.', 'root\cimv2','', '', '', '', 0, nil);
  Root := WMIServices.ExecQuery('Select SerialNumber From Win32_BaseBoard','WQL', 0, nil);
  Item := Root.ItemIndex(0);
  Result:=VarToStr(Item.SerialNumber);
end;

function GetComputerName: string;
var
  Buffer: array [0 .. MAX_COMPUTERNAME_LENGTH + 1] of Char;
  Size: Cardinal;
begin
  Size := MAX_COMPUTERNAME_LENGTH + 1;
  Windows.GetComputerName(@Buffer, Size);
  result := StrPas(Buffer);
end;


Alle Zeitangaben in WEZ +1. Es ist jetzt 17:50 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz