检测是否为.exe文件并判断文件是否存在

    
    //m_Path为文件路径
    //检测是否为exe
    LPTSTR pszExtension = PathFindExtension(m_Path);
    if (lstrcmp(pszExtension, L".exe") != 0)
    {
        MessageBox(_T("请先拖拽有效的exe文件"));
        return;
    }

    //检测文件是否存在
    if (GetFileAttributes(m_Path) == INVALID_FILE_ATTRIBUTES)
    {
        MessageBox(_T("文件不存在 请重试!"));
        return;
    }
原文地址:https://www.cnblogs.com/ndyxb/p/12821412.html