|
![]() |
|
t.roller
(Gast)
n/a Beiträge |
#1
Wer will, kann mal die beiden WMI-Abfragen vergleichen, ob etwas Eindeutiges auf eine physikalische Tastatur hinweisst.
Delphi-Quellcode:
//-----------------------------------------------------------------------------------------------------
// This code was generated by the Wmi Delphi Code Creator http://theroadtodelphi.wordpress.com // Version: 1.8.3.0 // LIABILITY DISCLAIMER // THIS GENERATED CODE IS DISTRIBUTED "AS IS". NO WARRANTY OF ANY KIND IS EXPRESSED OR IMPLIED. // YOU USE IT AT YOUR OWN RISK. THE AUTHOR NOT WILL BE LIABLE FOR DATA LOSS, // DAMAGES AND LOSS OF PROFITS OR ANY OTHER KIND OF LOSS WHILE USING OR MISUSING THIS CODE. //---------------------------------------------------------------------------------------------------- program GetWMI_Info; {$APPTYPE CONSOLE} uses (* SysUtils, ActiveX, ComObj, Variants; *) System.SysUtils, Winapi.ActiveX, System.Win.ComObj, System.Variants; function VarToInt(const AVariant: Variant): INT64;// integer; begin Result := StrToIntDef(Trim(VarToStr(AVariant)), 0); end; // Funktionen und Verwaltung der logischen Tastatur. procedure GetCIM_KeyboardInfo; const WbemUser =''; WbemPassword =''; WbemComputer ='localhost'; wbemFlagForwardOnly = $00000020; var FSWbemLocator : OLEVariant; FWMIService : OLEVariant; FWbemObjectSet: OLEVariant; FWbemObject : OLEVariant; oEnum : IEnumvariant; iValue : LongWord; begin; FSWbemLocator := CreateOleObject('WbemScripting.SWbemLocator'); FWMIService := FSWbemLocator.ConnectServer(WbemComputer, 'root\CIMV2', WbemUser, WbemPassword); FWbemObjectSet:= FWMIService.ExecQuery('SELECT * FROM CIM_Keyboard','WQL',wbemFlagForwardOnly); oEnum := IUnknown(FWbemObjectSet._NewEnum) as IEnumVariant; while oEnum.Next(1, FWbemObject, iValue) = 0 do begin Writeln(Format('Availability %d',[VarToInt(FWbemObject.Availability)]));// Uint16 Writeln(Format('Caption %s',[VarToStr(FWbemObject.Caption)]));// String Writeln(Format('ConfigManagerErrorCode %d',[VarToInt(FWbemObject.ConfigManagerErrorCode)]));// Uint32 Writeln(Format('ConfigManagerUserConfig %s',[VarToStr(FWbemObject.ConfigManagerUserConfig)]));// Boolean Writeln(Format('CreationClassName %s',[VarToStr(FWbemObject.CreationClassName)]));// String Writeln(Format('Description %s',[VarToStr(FWbemObject.Description)]));// String Writeln(Format('DeviceID %s',[VarToStr(FWbemObject.DeviceID)]));// String Writeln(Format('ErrorCleared %s',[VarToStr(FWbemObject.ErrorCleared)]));// Boolean Writeln(Format('ErrorDescription %s',[VarToStr(FWbemObject.ErrorDescription)]));// String Writeln(Format('InstallDate %s',[VarToStr(FWbemObject.InstallDate)]));// Datetime Writeln(Format('IsLocked %s',[VarToStr(FWbemObject.IsLocked)]));// Boolean Writeln(Format('LastErrorCode %d',[VarToInt(FWbemObject.LastErrorCode)]));// Uint32 Writeln(Format('Layout %s',[VarToStr(FWbemObject.Layout)]));// String Writeln(Format('Name %s',[VarToStr(FWbemObject.Name)]));// String Writeln(Format('NumberOfFunctionKeys %d',[VarToInt(FWbemObject.NumberOfFunctionKeys)]));// Uint16 Writeln(Format('Password %d',[VarToInt(FWbemObject.Password)]));// Uint16 Writeln(Format('PNPDeviceID %s',[VarToStr(FWbemObject.PNPDeviceID)]));// String Writeln(Format('PowerManagementCapabilities %d',[VarToInt(FWbemObject.PowerManagementCapabilities)]));// Array of Uint16 Writeln(Format('PowerManagementSupported %s',[VarToStr(FWbemObject.PowerManagementSupported)]));// Boolean Writeln(Format('Status %s',[VarToStr(FWbemObject.Status)]));// String Writeln(Format('StatusInfo %d',[VarToInt(FWbemObject.StatusInfo)]));// Uint16 Writeln(Format('SystemCreationClassName %s',[VarToStr(FWbemObject.SystemCreationClassName)]));// String Writeln(Format('SystemName %s',[VarToStr(FWbemObject.SystemName)]));// String Writeln(''); FWbemObject:=Unassigned; end; end; procedure GetWin32_KeyboardInfo; const WbemUser =''; WbemPassword =''; WbemComputer ='localhost'; wbemFlagForwardOnly = $00000020; var FSWbemLocator : OLEVariant; FWMIService : OLEVariant; FWbemObjectSet: OLEVariant; FWbemObject : OLEVariant; oEnum : IEnumvariant; iValue : LongWord; begin; FSWbemLocator := CreateOleObject('WbemScripting.SWbemLocator'); FWMIService := FSWbemLocator.ConnectServer(WbemComputer, 'root\CIMV2', WbemUser, WbemPassword); FWbemObjectSet:= FWMIService.ExecQuery('SELECT * FROM Win32_Keyboard','WQL',wbemFlagForwardOnly); oEnum := IUnknown(FWbemObjectSet._NewEnum) as IEnumVariant; while oEnum.Next(1, FWbemObject, iValue) = 0 do begin Writeln(Format('Availability %d',[VarToInt(FWbemObject.Availability)]));// Uint16 Writeln(Format('Caption %s',[VarToStr(FWbemObject.Caption)]));// String Writeln(Format('ConfigManagerErrorCode %d',[VarToInt(FWbemObject.ConfigManagerErrorCode)]));// Uint32 Writeln(Format('ConfigManagerUserConfig %s',[VarToStr(FWbemObject.ConfigManagerUserConfig)]));// Boolean Writeln(Format('CreationClassName %s',[VarToStr(FWbemObject.CreationClassName)]));// String Writeln(Format('Description %s',[VarToStr(FWbemObject.Description)]));// String Writeln(Format('DeviceID %s',[VarToStr(FWbemObject.DeviceID)]));// String Writeln(Format('ErrorCleared %s',[VarToStr(FWbemObject.ErrorCleared)]));// Boolean Writeln(Format('ErrorDescription %s',[VarToStr(FWbemObject.ErrorDescription)]));// String Writeln(Format('InstallDate %s',[VarToStr(FWbemObject.InstallDate)]));// Datetime Writeln(Format('IsLocked %s',[VarToStr(FWbemObject.IsLocked)]));// Boolean Writeln(Format('LastErrorCode %d',[VarToInt(FWbemObject.LastErrorCode)]));// Uint32 Writeln(Format('Layout %s',[VarToStr(FWbemObject.Layout)]));// String Writeln(Format('Name %s',[VarToStr(FWbemObject.Name)]));// String Writeln(Format('NumberOfFunctionKeys %d',[VarToInt(FWbemObject.NumberOfFunctionKeys)]));// Uint16 Writeln(Format('Password %d',[VarToInt(FWbemObject.Password)]));// Uint16 Writeln(Format('PNPDeviceID %s',[VarToStr(FWbemObject.PNPDeviceID)]));// String Writeln(Format('PowerManagementCapabilities %d',[VarToInt(FWbemObject.PowerManagementCapabilities)]));// Array of Uint16 Writeln(Format('PowerManagementSupported %s',[VarToStr(FWbemObject.PowerManagementSupported)]));// Boolean Writeln(Format('Status %s',[VarToStr(FWbemObject.Status)]));// String Writeln(Format('StatusInfo %d',[VarToInt(FWbemObject.StatusInfo)]));// Uint16 Writeln(Format('SystemCreationClassName %s',[VarToStr(FWbemObject.SystemCreationClassName)]));// String Writeln(Format('SystemName %s',[VarToStr(FWbemObject.SystemName)]));// String Writeln(''); FWbemObject:=Unassigned; end; end; begin try CoInitialize(nil); try GetCIM_KeyboardInfo; WriteLn('----------------------------------------------------------------'); GetWin32_KeyboardInfo; finally CoUninitialize; end; except on E:EOleException do Writeln(Format('EOleException %s %x', [E.Message,E.ErrorCode])); on E:Exception do Writeln(E.Classname, ':', E.Message); end; Writeln('Press Enter to exit'); Readln; end. |
![]() |
Ansicht |
![]() |
![]() |
![]() |
ForumregelnEs ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.
BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus. Trackbacks are an
Pingbacks are an
Refbacks are aus
|
|
Nützliche Links |
Heutige Beiträge |
Sitemap |
Suchen |
Code-Library |
Wer ist online |
Alle Foren als gelesen markieren |
Gehe zu... |
LinkBack |
![]() |
![]() |