How to center a window (Windows)?

Started by
2 comments, last by RidiculousX 17 years, 6 months ago
So I've made a splash screen but it's not centered. I need to center it. I was thinking of using SetWindowPos() with the SWP_NOSIZE flag to change its position, but I need to know the current display resolution. If someone could point me to a way to find the resolution or maybe an easier way altogether, that would be great. I've searched the Platform SDK documentation and looked on MSDN and Googled this problem, but didn't come up with anything (maybe I just suck at constructing a good search queary). Thanks in advance.
Advertisement
You want to use GetSystemMetrics() with SM_CXSCREEN and SM_CYSCREEN. If you need this on a non-primary monitor, then use GetDeviceCaps().


jfl.
Search MSDN for GetSystemMetrics(), I think that is what you are looking for.

Edit: Too late :)
My Blog
Thanks! This is good.

This topic is closed to new replies.

Advertisement