MFC 程序内部保存数据的一种方法

    HRSRC hRrc=::FindResourceW(NULL, MAKEINTRESOURCE(IDR_TEXT1),_T("TEXT"));
    if(hRrc==NULL)
    {
        AfxMessageBox(_T("hRrc is null"));
        return;
    }
    HGLOBAL hDataSource=::LoadResource(NULL,hRrc);
    if(hDataSource==NULL)
    {
        AfxMessageBox(_T("hDataSource is null"));
        return;
    }
    LPVOID memBlock= ::GlobalLock(hDataSource);
    char* p=(char*)memBlock;
    string data;
    while(*p!=EOF)
    {
        data.push_back((*p));
        p++;
    }
    ::MessageBoxA(m_hWnd,data.c_str(),"提示",MB_OK);
本人新博客网址为:http://www.hizds.com
本博客注有“转”字样的为转载文章,其余为本人原创文章,转载请务必注明出处或保存此段。c++/lua/windows逆向交流群:69148232
原文地址:https://www.cnblogs.com/zhangdongsheng/p/2657140.html