Click here to Skip to main content
15,892,697 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Guys,

I am a beginner at Inno Setup, I am trying to correct an existing code that is supposed to retrieve Matlab's Path using
RegQueryStringValue


My question is: how to know the parameters passed to this function, the SubKeyName the RootKey etc..? In other words, from the code below, where
SOFTWARE\MATLAB\9.
and
MATLABROOT
came from?

Your help is much appreciated.

What I have tried:

<pre>function Getmatlab(param: string): string;
var
  MatlabRoot: string;
begin
  log('start')
  if RegQueryStringValue(HKEY_LOCAL_MACHINE_64, 'SOFTWARE\MATLAB\9.5', 'MATLABROOT', MatlabRoot) then
  begin
    // Successfully read the value
    MsgBox('Your matlab root: ' + MatlabRoot, mbInformation, MB_OK);
  end  ;
   Result := MatlabRoot;
    
end;
Posted
Updated 3-Nov-19 22:03pm

You can check this out yourself: Inno Setup Help[^]

You may be interested in RegGetSubkeyNames[^] too.
 
Share this answer
 
v2
Comments
Member 14643676 4-Nov-19 4:31am    
Thank you for your answer!
the function RegGetSubkeyNames is really intresting! well, I found out that Matlab is not in the list of subkeys!! So that's why an error occurs while installing my application. Do you have an idea on how to add a subkey?

Thank you so much
Maciej Los 4-Nov-19 4:34am    
Member 14643676 4-Nov-19 5:02am    
Thanks!
Maciej Los 4-Nov-19 5:51am    
You're very welcome.
Example:
MyRegKey := '{5560A93B-C797-6799-925F-98FCAD57BC36}_is1';

//  HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{5560A93B-C797-6799-925F-98FCAD57BC36}_is1
  if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\' + MyRegKey, 'InstallLocation', MyPath) then
// your code ...

You can search the registry with Regedit, see: How to Use Regedit (with Pictures) - wikiHow[^]
Be careful when changing things, first make a backup of the registry !
 
Share this answer
 
v2
Comments
Member 14643676 4-Nov-19 5:04am    
Thank you for your answer!

the link for regedit is really helpful.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900