Exemplo n.º 1
0
void CMd5CalFile2Dlg::OnBnClickedButton1()
{
    // TODO: 在此添加控件通知处理程序代码
    m_showMd5Lower.SetWindowTextW(L"");
    m_showMd5Upper.SetWindowTextW(L"");
    LARGE_INTEGER liSize = { 0 };
    CString path;
    m_editPath.GetWindowTextW(path);
    FileMap fileMap;
    char* lpBuffer = (char*)fileMap.CreateFileMap(path.GetBuffer(), &liSize);
    std::wstring strRet = Md5Partially((unsigned char*)lpBuffer, 
        liSize.LowPart, 80*1024);
   
    m_showMd5Upper.SetWindowTextW(strRet.c_str());

    for (unsigned int i = 0; i < strRet.size(); ++i)
    {
        if ( strRet[i] >= L'A' && strRet[i] <= L'Z')
        {
            strRet[i] = strRet[i] - L'A' + L'a';
        }
    }
    m_showMd5Lower.SetWindowTextW(strRet.c_str());
}