1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| Sub test4()
Dim fso, f, chemin, ligne,i
chemin = " """ & ThisWorkbook.Path & "\rien.txt"" "
Set sh = CreateObject("WScript.Shell")
sh.Run "%comspec% /c REGEDIT /E " & chemin & """HKEY_CURRENT_CONFIG\System\CurrentControlSet\Control\VIDEO""", 0, True
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(ThisWorkbook.Path & "\rien2.txt", ForReading)
mescle = f.ReadAll
f.Close
ligne = Split(mescle, vbCrLf)
For i = 1 To UBound(ligne)
'"DefaultSettings.XResolution"=dword:00000780
'"DefaultSettings.YResolution"=dword:00000438
If InStr(ligne(i), "DefaultSettings.XResolution") > 0 Then largeur = Val(Split(ligne(i), ":")(1)) * 2.46153
If InStr(ligne(i), "DefaultSettings.YResolution") > 0 Then hauteur = Val(Split(ligne(i), ":")(1)) * 2.465: Exit For
Next
MsgBox largeur & " par " & hauteur
End Sub |
Partager