Success = 0
Failure = 1
So, given that, I created and integer named netcheck and set it equal to a system call, like so
int netcheck = system("wintools\\reg.exe query \"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v2.0.50727\\1033\" /v Install");
It is pretty nifty. If
netcheck == 0
then .NET Framework 2.0 is installed. If netcheck == 1
then .NET Framework 2.0 is not installed and the program then continues to ask you what you want to do. I should probably add support for .NET 3.0 and 3.5, though I am sure only Windows developers have that installed (I don't see a reason otherwise). Also, you must be running XP or Vista to install .NET Framework 3.0 or 3.5. If you are wondering what that last 1033 in the registry key is, that is the language (EN). In the real program, that isn't included for internationalisation support. I just thought you would get the same kick out of it that I did. It has been a while since I really did anything in C, but here is the source code to netcheck.exe, compiled with Dev-C++ (not CodeWarrior) with the 1033 included.
No comments:
Post a Comment