I have the following line in an instal file:

success := RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727', 'Install', install);

Clearly this is not going to detect any later versions that may have been installed on XP or 2000 but I can't seem to find any good example of less specific code or any good explanations of these RegQuery functions and the fields, eg what exactly is the difference between a key and a subkey?

They appear only to check or return keys specified in full. What I really need surely is to search for any keys containing "NET Framework Setup\NDP\v", read the entire value and then check the version number but can't figure out how to do that.

Grateful for any ideas.