How do i find the dimensions of a button?
Example:
I want to find the width of the start button, and the height and then
assign them to seperate ints.

int width=WindowWidth(Start);
int height=WindowHeight(Start);

The abbove functions are totally made up, so they are just
examples...

Recommended Answers

All 9 Replies

Member Avatar for iamthwee

You mean the start button on the windows menu?

Yes, that is what I mean, but sadly the dimensions change with the resolution, so I can't have just one good dimension.

GetClientRect() returns a RECT object with the coordinated, then simple subtraction will give you height and width.

I am totally clueless here, so how do i put the x value (width) into x and y value (height) into y
(where x and y are int datatypes)

I am totally clueless here, so how do i put the x value (width) into x and y value (height) into y
(where x and y are int datatypes)

did you read the link? First create a RECT object and pass a pointer to it to the GetClientRect() function. After that just assign x and y with simple subtraction of the RECT left, right, top and bottom integers. If you can't figure that much out then I doubt your ability to write a program that uses win32 api functions at all. Start with something a lot simpler.

If you can't figure that much out then I doubt your ability to write a program that uses win32 api functions at all. Start with something a lot simpler.

And your right in doing so, but you must understand that daniweb is the only good tutorial I have ever found, and it's not even a tutorial... So if you could give me a link to a godd (Prefferably downloadable) Windows API tutorial and/or helpfiles. I would be quite grateful!

(Next year I'll be taking Visual Basic, and C++, so hopefully haveing some actual classes will help. (If they don't then, well... maybe there is something wrong with me:cheesy:

please read through the Read Me posts at the top of this board -- they contain a wealth of information.

Here is a link to good win32 api tutorial

Thanks for all the help, not to complain, but some of you are very bad at answering a question.
I must also take part of the blame, as I am not to good at stating what I mean.
To clarify, I wanted to know how the structure RECT worked (as in what were the parts of it)

I found this out by looking at some source code.

Ancient Dragon - That tutorial you showed me is quite a help.

There is no one tutorial for all win32 api functions because there are hundreds, if not thousands, of them. Tutorials are ok for very beginners, but you will quickly out-grow them and will need to invest in a few good (but expensive) books.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.