Solved

how .NET  Framework is installed.

Posted on 2006-11-03
5
359 Views
Last Modified: 2010-04-24
Hi

How can i check that .NET  Framework is installed before launching my .NET  Framework application from c++ code?

Regards
0
Comment
Question by:quali
  • 2
5 Comments
 
LVL 12

Expert Comment

by:rajeev_devin
ID: 17865355
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 17865816
You can test whether mscoree.dll exists in the %SystemRoot%\system32 directory.
To determine which .NET Framework versions are installed, enunerate keys under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\policy
0
 

Author Comment

by:quali
ID: 17879649
>>You can test whether mscoree.dll exists in the %SystemRoot%\system32 directory.
how can i test it in c++ programme?
0
 
LVL 48

Accepted Solution

by:
AlexFM earned 250 total points
ID: 17879796
BOOL FileExists(LPCTSTR sFileName)
{
    TCHAR name[1000];

    ExpandEnvironmentStrings(sFileName, name, 1000);

    DWORD dwResult = GetFileAttributes(name);

    if ( dwResult == 0xffffffff  ||
        dwResult & FILE_ATTRIBUTE_DIRECTORY )
    {
        return FALSE;
    }

    return TRUE;
}

if ( FileExists(_T("%SystemRoot%\\system32\\mscoree.dll")))
{
    // exists
}
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

28 Experts available now in Live!

Get 1:1 Help Now