How to load a custom binary resource in a VC++ static library as part of a dll?

前端 未结 3 937
离开以前
离开以前 2020-12-01 04:42

I have custom binary resources (animated cursors) that would like to store as resources in a static lib in Visual Studio C++. It turns out that custom binary resources wi

3条回答
  •  伪装坚强ぢ
    2020-12-01 05:12

    In case you use dll using MFC (and CWinApp), you can obtain the HMODULE from CWinApp.

    extern MyDllApp theApp;
    HMODULE module = (HMODULE)theApp.m_hInstance;
    HRSRC myResource = ::FindResource(module,
                MAKEINTRESOURCE(IDR_FILE_RESOURCE), _T("GROUP_NAME"));
    

    If you supply NULL in FindResource, application won't find your resource.

提交回复
热议问题