Click here to Skip to main content
15,867,488 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear all
I have a windows application, I deploy my application using INNO setup Now I want to check installed Microsoft excel software version from registry How can I do using INNO setup/script ?
I have tried below code but failed
Delphi
function InitializeSetup(): Boolean;
 var
  CurVer: Cardinal;
  key: string;

if RegQueryDWordValue(HKCR, 'Excel.Application\CurVer\','', CurVer) then
  begin
    // Successfully read the value
      MsgBox('Excel Version: ' + IntTOStr(CurVer),mbInformation, MB_OK);
    end else begin
      MsgBox('Key not found',mbInformation, MB_OK);
  end;

end;


Thanks in advanced
Posted
Updated 19-Jul-14 2:20am
v13
Comments
Richard MacCutchan 19-Jul-14 6:23am    
What does "not working" mean?
kedar001 19-Jul-14 6:25am    
when i run the setup ,i didnt get any messagebox and setup gets closed
Richard MacCutchan 19-Jul-14 6:38am    
When someone asks what "not working" means, they expect you to do some proper problem analysis and diagnosis to find out why it is not working. We have no access to your system so cannot guess what may be happening. As with so much code we see these days you have made an assumption that the key you are looking for will exist on the target system, but you have made no allowance for the situation when it does not exist. A quick manual check in the registry would confirm that fact.
kedar001 19-Jul-14 6:55am    
yes,key not found,but key exist in the registry
how i can get installed office Excel Version ?
[no name] 19-Jul-14 7:21am    
The 'key' CurVer exists but there is no value named 'CurVer' which is what you are trying to get.

1 solution

Delphi
function InitializeSetup(): Boolean;
 var
  CurVer: Cardinal;
  key: string;

begin
    //HKEY_CLASSES_ROOT\Excel.Application\CurVer

    //if RegQueryDWordValue(HKCR, 'Excel.Application\\CurVer\\','', CurVer) then
     if RegQueryStringValue(HKCR, 'Excel.Application\CurVer\','', key) then
  begin
    // Successfully read the value
      MsgBox('Excel Version: ' + key,mbInformation, MB_OK);
    end else begin
      MsgBox('Excel Not installed',mbInformation, MB_OK);
  end;

end;
 
Share this answer
 

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



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