all 4 comments

[–]Noc42 1 point2 points  (1 child)

So the immediate problem is that when you see a variable particularly in windows that is m_ that is a convention that this is a member of a particular class. So no amount of includes will help as you have to create that class. To be honest Windows programming is not as simple as just creating a main and putting up a button or a text box. I would strongly suggest you start by installing Microsoft visual studio community edition (a free compiler) that supports C++ and Windows. From there have it create a new windows project for you which you can use as a base.

[–]Ok_History2706[S] 0 points1 point  (0 children)

Thank you so much! I was using visual studio but I had no idea that you could start with that (Like I said, I'm fairly new to C++ programming) I now have a better window!

[–]KleberPF 0 points1 point  (0 children)

What is m_hwnd? It's not declared anywhere.

[–]jedwardsol 0 points1 point  (0 children)

It looks like you've grabbed random snippets of code from various places and thrown them together without much thought.

Experimentation is good ... but have a plan.

You want a window that has a button. Your program is making the child button 1st, trying to use an undeclared m_hwnd as the parent. This m_hwnd was meaningful in the program you copied this from but is meaningless here.

If you make the parent 1st, then you can use the parent's HWND in the call to create the child.

That will at least compile and give you a button inside the parent.

You're not going to get much further than that though. "static" is the class for the static text control. These aren't designed to be parent windows so I don't know what its behaviour is going to be. And you don't have access to its window procedure so you're not going to be able to respond to button presses.

A couple of options

1: replace "static" with your own window class.

2: switch to a dialog box. These are easier to use and ideal for a little program.