In such a case I'd recommend to subclass the CMFCPropertySheet (derive your own class from it) and overload the SetIconsList method. Or better implement the new method (say, ReplaceIcon) that would directly manipulate (remove/add/replace an image) with the m_Icons imagelist.
Then investigate the afxpropertysheet.cpp (and probably some more (friend and other classes) source code to see where and how the m_Icons imagelist is involved and try to change it according to your needs!
Got the answer mostly due to Microsoft Q&A This code placed in the derived property sheet works if the bitmap images are all of exactly the same size Thanks also to Victor Nijegorodov for his suggestions:
retval=m_wndPane1.AddButton(m_bmpimgs, "Create a Job", 10050, 0);
retval=m_wndPane1.AddButton(m_bmpimgs, "Manage a Job", 10051, 1);
retval=m_wndPane1.AddButton(m_bmpimgs, "Restore a Job", 10052, 2);
I am not really sure what you mean by 'try to load the .exe as a resource' does the bitmap have to be linked into the .exe
Just open your VS, then Menu -> File -> Open -> find in the open file dialog (File Explorer) your .exe file -> open it!
Then you will see the tree with all the embedded resources. Just navigate to the Bitmap hive and ensure that the bitmap with your bitmap ID does exist!
You should not need to as the location is only required by the compiler when it builds the executable. Part of the build process is to embed all resources into the final executable. You can check it by getting hold of one of the many free resource editors available online.
Did a Cimage load the HRESULT was 0 did CBitmap::Attach (there is not documentation on this) but return code was 1 when I looked at the n_hObject in VS debugger it had high order X'FF' the handle was FFFFFFFF88052070 never saw a resource handle with high order X'FF' ITS usually zeros
As I have mentioned previously I do not have MFC. But recreating what you are trying to do in pure Win32 (which is what MFC does under the covers) I have successfully loaded and displayed a bitmap resource.