Creating icon stream from resource file?

164 Views Asked by At

Win32 MFC

I can load an icon stream (to use with WebView2) from a physical ICO file on my hard drive. Eg:

wil::com_ptr<IStream> iconStreamPdfSettings;
CHECK_FAILURE(SHCreateStreamOnFileEx(
    L"d:\\Icons\\settings.ico", STGM_READ, FILE_ATTRIBUTE_NORMAL, FALSE,
    nullptr, &iconStreamPdfSettings));

I would like to add the ICO file as a resource in my executable. If I do that, how can I turn the embedded resource ICO into one of these wil::com_ptr<IStream> objects?

0

There are 0 best solutions below