Your referenced Main.cpp (and accompanying files) is Visual Studio.
Hours of fighting with yet another visual studio mess and my dog might as well have been chewing on the keyboard.
I have forced yet another visual studio mess to compile with no visual studio installed. I looked through it's logic and the referenced program is no use to me.
All that I found unique from my code was some subclassing that I can already do and some transparencies that I can already do. I see no use in either of those and any of the referenced visual studio pseudo-code addressing my *original* question.
Please do not send me any more Visual Studio mess.
Thank you for attempting to help. It is not your fault that visual studio is so far from Stroustrup's genius.
Back to the original issue:
When I create a window in C++ and place a bitmap in the background and place buttons and listboxes, etc. on that window, it can compile and I can see these.
When I do similar but use a buffered background where I place a bitmap and then place the buffer to the screen then place buttons and listboxes, etc. on that window, it can compile but my child windows are invisible as soon as I click on any thing in the main window for any change of that main window.
Maybe I might have explained the original issue better, maybe?
But, you offered help, and that was nice and I thank you.
First it was pre-compiled in the debug directory, you didn't have to compile anything
Second main.ccp is stock standard C++ code will compile on any C++ windows compiler
Third you can also just rename main.cpp to a main.c file remove a couple of "::" and it would compile on any C windows compiler
What I do now know is your level of programming knowledge which is useful if you want me to try and help you.
So basically I am reading your bitmap paint is drawing over the top of the listboxes and other windows, it would be useful to see the original code that creates the parent window. I am basically thinking you are trying to draw a bitmap where the coloured gradient occurs on my sample is that correct? Notice my listboxes draw over the top of that gradient and I could turn it to a bitmap if that helps you. I might throw up a sample doing that, note I will put just the main.c and the exe this time.
2.) If all else fails because you really have cocked something just invalidate them after you paint the background (that probably means after EndPaint in your WM_PAINT message handler).
Here hwnd refers to the handle of the child listbox window etc
Now if you have to use 2 you have a horrible structural issue with your code and I will try to explain how to fix it because we need to get the bitmap background draw much earlier on in the paint process.
Because you are still doing it wrong. Creating Windows applications that correctly display bitmaps, textboxes, listboxes etc., is standard and works all round the world. If you want multiple controls in a single Window then you must place them alongside, not on top of, each other. The best way to do that is to use a Dialog which is designed for exactly that purpose.
He is doing it runtime, go to his first post you can see he is inserting the ListBox into the main window, that code will be in the WM_CREATE of a window or WM_INITDIALOG of a dialog.
I assumed in his rather crazy round about way what he was asking is to paint the ListBox to a memory DC rather than the screen DC.
He seems to be calling HDC "buffers" see his names ===> HDC_of_FRONT_BUFFER
Anyhow that is easy you just use the WM_PRINTCLIENT message which you subclass onto a class and handle it. WM_PRINTCLIENT message (Winuser.h) - Win32 apps | Microsoft Docs[^]
You use that mainly for printing a screen capturing of a window or remote terminal programs where you need to send the screen data.
So I gave him an example that does that, but he either doesn't understand or he is doing something really strange.
I`m trying to build a barebones MFC app. I`m used to C# Forms, but I`m having a tough time in MFC though.
I`m creating a new MFC app in the New Project dialog and in the Wizard I pick Dialog based app as app type. However after creation I can`t open the resource (in the resource view) to fill it with controls.
it`s a totally fresh project, no edits after pressing the `Finish` button in the create app wizard/dialog. I`m expecting to be able to add new controls from ToolBox but obviously something is missing...
I do not think MFC apps make use of the Toolbox. If you double-click the resource file (projectname.rc) in Solution Explorer, it should open the Resource Editor where you can add the various controls to your dialog.
The recommended MFC way is to create a control member variable (of the type CStatic or any derived from CStatic class) for this picture control. Then you will be able use all the methods of this class.