gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

The condition from my previous post was an test example (I didn't know that 9.0 is not the real version of DirecX). The real DirectX9.0c version is 4.09.0000.0904. So the condition you should use is:

Code: Select all

SEARCH_PROPERTY < "4.09.0000.0904"

Code: Select all

SEARCH_PROPERTY >= "4.09.0000.0904"
For all available versions of DirectX please see:
http://www.computerhope.com/directx.htm

Best Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
shadyfan
Posts: 45
Joined: Sat Nov 25, 2006 8:15 pm

Yes, I realised that, but a problem occured when I reinstalled my operating system. The registry value of the DirectX key was: "4.09.00.0904". I don't what does this depend on, but it was a fresh reinstallation of Windows XP Professional Edition. So if I can make something like a condition to check if the user's value is "4.09.0000.0904" or "4.09.00.0904". But I don't know how it's done. Maybe if AI could change the registry value from "4.09.00.0904" to "4.09.0000.0904" during the installation it would be OK.
I hope it's possible :-)
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,
So if I can make something like a condition to check if the user's value is "4.09.0000.0904" or "4.09.00.0904". But I don't know how it's done.
If you want to check explicitly for DirectX9.0c then the conditions you should use are:

To display the DirectX dialog use (the DirectX need to be installed):

Code: Select all

SEARCH_PROPERTY <> "4.09.0000.0904" OR SEARCH_PROPERTY <> "4.09.00.0904"
To skip the DirectX dialog use (the DirectX is already installed):

Code: Select all

SEARCH_PROPERTY = "4.09.0000.0904" OR SEARCH_PROPERTY = "4.09.00.0904"
Best Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
shadyfan
Posts: 45
Joined: Sat Nov 25, 2006 8:15 pm

Hi,
No I need to check if the user has DirectX 9.0c or higher.
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

This cannot be done by comparing the versions as strings, you need to compare them as numbers. The only way to do that is through a custom action. Here is a VBS code that do that:

Code: Select all

Dim arrayReqVers, arrayFoundVers

requiredVersion = "4.09.0000.0904"
foundVersion = Session.Property("SEARCH_PROPERTY")

arrayFoundVers = Split(foundVersion, ".", -1, 1)
arrayReqVers = Split(requiredVersion, ".", -1, 1)

found = -1
If UBound(arrayFoundVers) = 3 Then
	For i = 0 To 3
		nr1 = CInt(arrayFoundVers(i))
		nr2 = CInt(arrayReqVers(i))
		If nr1 > nr2 Then
			Session.Property("DIRECTX") = "TRUE"
			Exit For
		ElseIf nr1 = nr2 Then
			found = found + 1
		Else 
			Exit For 
		End If 
	Next
	If found = 3 Then
		Session.Property("DIRECTX") = "TRUE"
	End If
End If 
Copy this code to a .vbs file and add it as "New Attached Custom Action" in the "Custom Actions" page under "InstallUISequence->AppSearch" standard action. Leave the "Function Name" empty and use (Not Installed) as "Execution Condition".

Define the DIRECTX property in the "InstallParameters" page with "FALSE" for its value (without quotes).

Now switch to "Dialogs" page and use those conditions to display the dialogs:

To display the DirectX dialog use (the DirectX need to be installed):

Code: Select all

DIRECTX = "FALSE"
To skip the DirectX dialog use (the DirectX is already installed):

Code: Select all

DIRECTX = "TRUE"
Please let me know if you encounter any problems.

Best Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
shadyfan
Posts: 45
Joined: Sat Nov 25, 2006 8:15 pm

Hi,
I want to thank you very much!!! :D
Thank you for the script, I don't know how, but it really worked! :)
shadyfan
Posts: 45
Joined: Sat Nov 25, 2006 8:15 pm

Hi,
I'm making another installator now and unfortunately in this new case the DirectX check doesn't work. I'm trying to show different texts if a user has or hasn't a minimum DirectX version.
I tried using Control Conditions for showing and not showing text but it works every time in the same way - if there is or there isn't DirectX found the same text appears.
Here is what I do: I'm making 2 textboxes: Text 1 is for a user having DirectX and Text 2 is for the opposite. I make the two texts invisible by default.
Here are the control conditions:
Text1: "DIRECTX" - "Show"
Text2: "NOT DIRECTX" - "Show"

Sorry for the long post, but it was hard to explain with less words :)
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

I'm afraid I don't fully understand the problem you encounter. If you use the same approach like in my previous posts then the conditions you should use are:

Text1: DIRECTX = "TRUE" - "Show"
Text2: DIRECTX = "FALSE" - "Show"

Also by default both static texts need to have the "Visible" flag set to false.

If this does not help, please give me more details.

Regards,
Gigi
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com/
shadyfan
Posts: 45
Joined: Sat Nov 25, 2006 8:15 pm

Hi,
It still doesn't work :( It's showing Text2 in every case (when the version is 9.0c, when it's lower, or higher).
I'm just wondering about the Install Parameters properties. You advised me to make a new property called DIRECTX with a value FALSE. Why is the value "FALSE"? I tried changing it to "TRUE" and the effect was the opposite - the text shown was Text1 in every case.
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

This works on my test computer, the Text1 is shown if the DirectX version found on the target computer is equal or greater than the one specified in the CA script. Else the Text2 is shown.

The DIRECTX value is FALSE by default which means that the required DirectX version is not found. The DIRECTX value is changed to TRUE (see the script) in case the required DirectX version is found.

Regards,
Gigi
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com/
shadyfan
Posts: 45
Joined: Sat Nov 25, 2006 8:15 pm

Hi,
It finally worked :D The problem was that I didn't make a search like in my previous project "DIRECTX_SEARCH". I thought it was unnessessary.
Thank you very much, and sorry for bothering you.

Return to “Common Problems”