国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
Get The Name Of The Windows OS Installed on a Machine

Get The Name Of The Windows OS Installed on a Machine

Win32_OperatingSystem?WMI class represents Windows OS installed on a computer

By

Windows Management Instrumentation (WMI) is the infrastructure for management data and operations on Windows-based operating systems.

You can use Delphi to communicate with WMI by using a variety of interfaces. All the WMI interfaces are based on the Component Object Model (COM).

Use Win32_OperatingSystem to Get The Installed Windows Version Name

The Win32_OperatingSystem?WMI class represents a Windows-based operating system installed on a computer.

The Caption property of the Win32_OperatingSystem?WMI class returns a short description of the object (a one-line string). The string includes the operating system version. For example, "Microsoft Windows XP Professional Version = 5.1.2500".

Here's how to read the Windows OS Name from Delphi:

uses ActiveX;

function GetWin32_OSNameVersion : string;
var
  objWMIService : OLEVariant;
  colItems      : OLEVariant;
  colItem       : OLEVariant;
  oEnum         : IEnumvariant;
  iValue        : LongWord;

  function GetWMIObject(const objectName: String): IDispatch;
  var
    chEaten: Integer;
    BindCtx: IBindCtx;
    Moniker: IMoniker;
  begin
    OleCheck(CreateBindCtx(0, bindCtx));
    OleCheck(MkParseDisplayName(BindCtx, StringToOleStr(objectName), chEaten, Moniker));
    OleCheck(Moniker.BindToObject(BindCtx, nil, IDispatch, Result));
  end;

begin
  try
    objWMIService := GetWMIObject('winmgmts:\\localhost\root\cimv2');
    colItems      := objWMIService.ExecQuery('SELECT * FROM Win32_OperatingSystem','WQL',0);
    oEnum         := IUnknown(colItems._NewEnum) as IEnumVariant;
    if oEnum.Next(1, colItem, iValue) = 0 then
      result := Format('%s %s',[colItem.Caption, colItem.Version]);
  except
    result := '?'
  end;
end;

Note: there's also the Win32MajorVersion and Win32MinorVersion defined in the System.pas you can use to create a Get Windows version function - but still you would need to turn results from GetVersionEx into a string representation.

Further, search for WMI and Win32_OperatingSystem for much more usage ideas...

本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
Powershell 管道原理分析
Excel FAQ 【網(wǎng)絡(luò)應(yīng)用】
Python實現(xiàn)的監(jiān)測服務(wù)器硬盤使用率腳本分享
Golang獲取機器碼(MachineCode、PhysicalId)
WMI問題答案集錦
【轉(zhuǎn)】用Javascript獲取客戶端網(wǎng)卡信息
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服