Ich hoffe das einer von euch noch irgenwo einen Windows ME rechner hat.
Die SysInfo Class hat noch einige Schwachstellen, welche ich versuche auszubessern.
Bsp: bei der Systemversion erscheint Windows 2000 obwohl WinXP installiert ist.
Die Seriennummer des PC's ist noch nicht auslesbar. Bei einigen Geräten ist dies allerdings Möglich (Compaq, IBM)
(Hat dazu jemand den passenden Api aufruf ?)
Die Festplatten Serien Nummer ist (zumindestens bei SCSI Platten) falsch.
Abfrage Windows NT basierend oder nicht..
registryGetKey(HKEY_LOCAL_MACHINE,"SYSTEM\CurrentControlSet\Control\Session Manager\Environment","OS")
="Windows_NT" (winNT,win2000,WinXP)
=! Windows 98 Se,Windows 98,Windows 95 = KEY NICHT VORHANDEN
Windows ME
Abfrage nach der Version
registryGetKey(HKEY_LOCAL_MACHINE,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","ProductName")
= (bsp Microsoft Windows XP)
bzw für win9x
registryGetKey(HKEY_LOCAL_MACHINE,"SOFTWARE\Microsoft\Windows\CurrentVersion","Version")
ServicePack
registryGetKey(HKEY_LOCAL_MACHINE,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CSDVersion")
(Windows NT basierend)
Wie ist die abfrage für Win9x / WinME
registryGetKey(HKEY_LOCAL_MACHINE,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CurrentVersion")
= (Maijor,Minor Version - 5.1 bei XP)
(Windows NT basierend)
Wie ist die abfrage für Win9x / WinME
Codebeispiel
# Declare
Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (Byval hkey As Long, Byval lpSubKey As String, Byval ulOptions As Long, Byval samDesired As Long, phkResult As Long) As Long
Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (Byval hkey As Long, Byval lpValueName As String, Byval lpReserved As Long, lpType As Long, Byval lpData As String, lpcbData As Long) As Long
Declare Function RegCloseKey Lib "advapi32.dll" (Byval hkey As Long) As Long
Dim hKey As Long, result As Long, length As Long
Dim sValue As String, sReturn As String,sStartImport As String, sStartExport As String,sStartReady As String
# Options
Option Public
Const HKEY_LOCAL_MACHINE = &H80000002
Const SYNCHRONIZE = &H100000
Const STANDARD_RIGHTS_READ = &H20000
Const KEY_QUERY_VALUE = &H1
Const KEY_ENUMERATE_SUB_KEYS = &H8
Const KEY_NOTIFY = &H10
Const KEY_READ = ((STANDARD_RIGHTS_READ Or KEY_QUERY_VALUE Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY) And (Not SYNCHRONIZE))
Const ERROR_SUCCESS = 0&
Const REG_SZ = 1
function registryGetKey(hkey As Long,KeyName As String,KeyEntry As String)
' open the key
result=RegOpenKeyEx(HKEY, KeyName, 0, KEY_READ, hKey)
If result <> ERROR_SUCCESS Then
ErrorValue%=1
Goto eventHandle
Else
sValue=Space$(128)
length=128
' query the value of the key
result=RegQueryValueEx(hKey,KeyEntry, 0, REG_SZ, sValue, length)
' display it
If result = ERROR_SUCCESS Then
REM Messagebox Left$(sValue, length)
sReturn=""
For anz=1 To length
If Asc(Mid$(sValue,anz,1))>0 Then
sReturn=sReturn+Mid$(sValue,anz,1)
End If
Next
End If
' close the key
Call RegCloseKey(hKey)
End If
registryGetKey=sReturn
Exit Sub
eventHandle:
If ErrorValue%=1 Then
Message="Can't open key"
Elseif ErrorValue%=2 Then
Message=Left$(sValue, length)
End If
End Sub