The attached code (Create Window.zip) demonstrates how to use the CreateWindowEx API function to create a window and controls inside it.
Printable View
The attached code (Create Window.zip) demonstrates how to use the CreateWindowEx API function to create a window and controls inside it.
Nice demo!
However, for .hbrBackground = COLOR_BTNFACE to display as intended, MSDN says "the value 1 must be added to the chosen color".
The window title couldn't be set properly even though the algorithm looks alright...
The test on GetMessage's return value correctly follows MSDN's recommendation. :thumb:
Thanks for the reply. I fixed the hbrBackground property assignment (See my first post in this thread for the code.) I can't find anything wrong with the code that sets the new window title. What version of Windows are you using?
I'm using Microsoft Windows 7 Home Premium 64 bit.
I tested your code on Win XP Pro SP2.
I tried it again and it turns out that adding a manifest (be it compiled or in the IDE) causes the Edit control to misbehave. I have yet to pinpoint the exact problem, but it seems the GetWindowText routine (which uses SendMessageA) doesn't work properly with the Edit control from comctl32.dll. I often use Unicode APIs in conjunction with manifests which is why I've never encountered this issue before. However, your code do perform as expected when not using a manifest.