Detect the DirectX's version installed: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (Added category links.) |
(Handle double digit major version) |
||
(5 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{ | {{PageAuthor|Joel}} | ||
== Description == | == Description == | ||
This | This will detect the current installed version of the DirectX. | ||
Hope that will work with v7 and lower. | Hope that will work with v7 and lower. | ||
Bugs? PM | Bugs? PM | ||
Line 17: | Line 15: | ||
Function .onInit | Function .onInit | ||
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\DirectX" "Version" | ReadRegStr $0 HKLM "SOFTWARE\Microsoft\DirectX" "Version" | ||
StrCpy $1 $0 | StrCpy $1 $0 5 2 | ||
StrCpy $0 $1 1 | |||
StrCmp $0 "0" 0 +2 | |||
StrCpy $1 $1 "" 1 ; Remove leading 0 | |||
MessageBox MB_OK $1 | MessageBox MB_OK $1 | ||
Quit | Quit | ||
Line 28: | Line 29: | ||
Thanks KichiK for the "StrCpy" idea :p | Thanks KichiK for the "StrCpy" idea :p | ||
[[ | [[Category:Other Products Version Detection Functions]] | ||
[[Category:DirectX]] |
Latest revision as of 19:39, 13 April 2020
Author: Joel (talk, contrib) |
Description
This will detect the current installed version of the DirectX. Hope that will work with v7 and lower. Bugs? PM
The Script
OutFile "DirectX.exe" Name "Detect DirectX version" Caption "Detect DirectX version" XPStyle "on" Function .onInit ReadRegStr $0 HKLM "SOFTWARE\Microsoft\DirectX" "Version" StrCpy $1 $0 5 2 StrCpy $0 $1 1 StrCmp $0 "0" 0 +2 StrCpy $1 $1 "" 1 ; Remove leading 0 MessageBox MB_OK $1 Quit FunctionEnd Section "-boo" ; SectionEnd
Thanks KichiK for the "StrCpy" idea :p