Jump to content

Read FS9 Path from Registry-Something goes wrong


Recommended Posts

Hi!

I am making an installer for "GAP" which will contain all its sceneries so far. Everything goes as planned but when it comes to read the FS9 path from the registry, then the problems occur. I've followed this tutorial which teaches me how to make Installshield read a path from the registry. Works fine. Then I change the settings to:

problem2.jpg

and it doesn't work.

What am I doing wrong? What are the correct settings?

Thank you in advance

Link to post
Share on other sites

Hi Panos,

I have just had a look on my flight sim PC and I think the "Registry Value: Optional" field should not be "Path" but should be something like "C:Program FilesMicrosoft GamesFlight Simulator 9" ????

Cheers

Link to post
Share on other sites

Yes I did read the tutuorial and in my experience it is telling you the enter the path to where FS9 is as that is where the root directory should be for the program?

I have used installers before to install aircraft and scenery :wacky:

Have you tried it ?

Link to post
Share on other sites

1)Rich has seen my post at JF and has emailed me. He uses a very different method in reading the path. He told me:

"Pass it the reg path and the key name and it will return you the path as a string from "EXE Path".

Something like this should work:

RegDBSetDefaultRoot( HKEY_LOCAL_MACHINE);

RegDBGetKeyValueEx ("Software//etc","EXE Path", REGDB_STRING, svValue, nvSize );

TARGETDIR = svValue;

To test put this at the end and it should pop up a message box that shows you the path to FS on your PC:

MessageBox(svValue,INFORMATION);"

I didn't quitly get those. Then:

The best place for the script is in the OnFirstUIBefore() section.

There is no reason why you can't do a search in the registry but this is the best way (the user doesn't see the search take place doing it this way).

Once you have the info from the registry assigned to TARGETDIR, try something like this

szDir = TARGETDIR;

nResult = SdAskDestPath( szTitle, szMsg, szDir, 0 );

TARGETDIR = szDir;

This will then show the user the path that they had stored in the registry so that they can confirm it is correct and then give them the chance to alter it to something else if they wish.

I haven't understood in which location I should enter those scripts

2)I think yes

3) What you had told me to do, doesn't work

Link to post
Share on other sites

Thanks Panos,

I will have a look.

EDIT- Well, I will have to download the evaluation version to see what's going on but I cannot do this until the weekend.

If you don't get any luck in getting this to work I can try then. (I have to go back to work tomorrow :doh )

Maybe a polite mail back to Rich is in order to see if he can help more?

Cheers

Link to post
Share on other sites

From Rich:

Try this, just copy it all in over the top of the existing OnFirstUIBefore section and it should work fine:

function OnFirstUIBefore()

number nResult,nvSize,nvType;

string szTitle, szMsg,szPath;

string szName, szDir,svValue;

begin

//get reg info//

RegDBSetDefaultRoot( HKEY_LOCAL_MACHINE);

szPath="SOFTWAREMicrosoftmicrosoft gamesflight simulator9.0";

RegDBGetKeyValueEx (szPath,"EXE Path", nvType, svValue,nvSize);

TARGETDIR = svValue;

//MessageBox(svValue,SEVERE);

Dlg_SdWelcome:

szTitle = "";

szMsg = "";

nResult = SdWelcome( szTitle, szMsg );

Dlg_SdAskDestPath:

szTitle = "";

szMsg = "";

szDir=svValue;

nResult = SdAskDestPath( szTitle, szMsg, szDir, 0 );

TARGETDIR = szDir;

if (nResult = BACK) goto Dlg_SdWelcome;

return 0;

end;

----------------------------------------------------------------------------------

Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...