[C#] Office Detection Not Working

Discussion in 'Mixed Languages' started by CODYQX4, Oct 20, 2012.

  1. CODYQX4

    CODYQX4 MDL Developer

    Sep 4, 2009
    4,803
    45,246
    150
    I have a bug in MTK 2.4 and I can't find the cause or any reason why it should occur.

    People who have Office 2010 installed aren't getting it detected.

    Here is the source of the Product Detection component of MTK, I was wondering if anyone can find the bug, as I've given up and I'm so frustrated I want to just bury MTK 2.4, after the year I spent rewriting it.

    http://www.datafilehost.com/download-23d1b484.html
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. BobSheep

    BobSheep MDL Guru

    Apr 19, 2010
    2,326
    1,358
    90
    #2 BobSheep, Oct 20, 2012
    Last edited: Oct 20, 2012
    In function GetOfficeName you should search in descending versions order, 14.0 first then lower. I had 2007 and installed 2010. The reg key InstallRoot is still present for 12.0. Your code will skip out when 12.0 is detected before 14.0 can be checked.

    I meant 15.0 then lower. But you understood ayway.
     
  3. Pr3acher

    Pr3acher MDL Member

    Aug 24, 2012
    142
    48
    10
    #3 Pr3acher, Oct 20, 2012
    Last edited: Oct 20, 2012
    Hi, i think the bug is that you're using return for each detection. Try to use something else than a return to get office version. Actually if many versions were installed, somes keys could have been kept in the registry and the prog will return at the first key it has detected. I dont know if what i said can help you cuz i use to code C/C++ WinApi not C#...
    You can try a bool for each version and change em to 1 if detected: 0 not detected 1: detected
     
  4. CODYQX4

    CODYQX4 MDL Developer

    Sep 4, 2009
    4,803
    45,246
    150
    That may be it, I believed it to show the name in the info stuff in this case, but it doesn't.

    It should, however, then look for the Path value once it finds the InstallRoot key.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. CODYQX4

    CODYQX4 MDL Developer

    Sep 4, 2009
    4,803
    45,246
    150
    Once I adjust the order that should be OK. I don't support multiple installs, and I want the highest version.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. ThorndikePDF

    ThorndikePDF MDL Novice

    Mar 11, 2013
    2
    0
    0
    I support trying to use something else than a return to get office version, using code in c# is a little difficult, you need be patient.