C++ determines whether the machine has a .Net environment

巴扎黑
Release: 2016-12-20 14:35:44
Original
1624 people have browsed it

可以判应用程序文件夹下是否有.net环境的文件夹来解决。


Cpp代码 

int main(int argc, char* argv[])  
{  
    char winDir[256]={0};  
    GetWindowsDirectory(winDir, 256);  
    //strcat(winDir,"\\Microsoft.Net\\");  
    printf("%s\n",winDir);  
    //test .net exist.  
    char tcProgramFile[MAX_PATH] = {0};  
    SHGetSpecialFolderPath(NULL,tcProgramFile,0x26,0);   
    strcat(tcProgramFile,"\\Microsoft.NET");  
    printf("%s\n",tcProgramFile);  
    HANDLE hFind;  
    WIN32_FIND_DATA FindFileData;  
    hFind = FindFirstFile(tcProgramFile,&FindFileData);  
    if(hFind == INVALID_HANDLE_VALUE)  
    {  
        printf(".Net not exist!\n");  
        exit(1);  
    }  
    else  
    {  
        printf(".Net environment ok!\n");  
    }  
        return 0;  
}
Copy after login



Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!