Screen Stuff

I am sick to the top of my head with searching Win API help and others and getting every subject under the sun EXCEPT the one I'm looking for.

I want to get the position of my window. I want to determine the exact position of that window so I can save the info and then display that window in that exact same position the next time I open it.

Which functions do I need to do that?
http://www.codeguru.com/Cpp/W-D/doc_view/windowpositionssizes/article.php/c3287

The code is for MFC, but you probably get the idea. GetWindowPlacement(), the native Windows function, is explained here: http://msdn.microsoft.com/en-us/library/ms633518(VS.85).aspx.

The example saves the coords in the registry using MFC's WriteProfile*() functions. If you are not using MFC, I would say the equivalents are Read/WritePrivateProfileString(). Those are very old API's, so I would stay out of it. Just stream the values into a config file, or write them to the registry using good ol' registry functions.
GetWindowRect() is pretty useless for this, but thanks for the attempt.

webJose: I think you may be onto something with the second link. I am using straight Win32 API, and I (and many others, still use GetPrivate/WritePrivate ProfileString().)

From a practical standpoint, I don't think they are out of date at all. They are still heavily used.

I will explore the links you gave me. I will also have to locate some old code and go through it, for I have actually done this before, but I can't remember what I did. I'll also wade through Petzold, as I think he also covers it.

But first I'll try the second link you gave me. At first glance, that may be what I need.
EDIT: Apparently WebJose already solved it. Guess I should read before posting. XD
Last edited on
FWIW, GetWindowPlacement() and SetWindowPlacement() did the trick. Thanks again.
Topic archived. No new replies allowed.