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?
FindResource->LoadResource->LockResource/SizeOfResource->SHCreateMemStream.std::vector), and then create a stream over that. Unfortunate.RT_RCDATA) resources rather than actual icons, the steps from my first comment will work. If you aren't otherwise using those icons in your application then that may be a convenient way to go about it.typeIDcan be any unique string, such as"RawIconData", preferable#defined in resource.h so that both the .rc file and source code agree on the same name.