From: Piranha on
I have an application that saves its window size and position into a
file upon close and reopens in the same position next time.

Unfortunately it doesn´t work on a dual screen system, no matter on
which screen the window is located before close, it always (re-)opens
on the 1st screen.
It does keep its position on the screen, it just doesn´t remember on
which screen it has been.

In other words, I need a way to include the screen identification into
the save of window position and upon reopen I have to MoveWindow()
onto the right screen.

Is there a way in GetWindowRect() or GetClientRect() and MoveWindow()
to do this, or how else can it be done?
From: Matt on
On May 19, 2:30 pm, Piranha <eu_pira...(a)gmx.net> wrote:
> I have an application that saves its window size and position into a
> file upon close and reopens in the same position next time.
>
> Unfortunately it doesn´t work on a dual screen system, no matter on
> which screen the window is located before close, it always (re-)opens
> on the 1st screen.
> It does keep its position on the screen, it just doesn´t remember on
> which screen it has been.
>
> In other words, I need a way to include the screen identification into
> the save of window position and upon reopen I have to MoveWindow()
> onto the right screen.
>
> Is there a way in GetWindowRect() or GetClientRect() and MoveWindow()
> to do this, or how else can it be done?

I suspect you need MonitorFromRect to determine which monitor the
window is displayed upon. Take a look at this link and see if it
helps.

http://msdn.microsoft.com/en-us/library/dd162826

Matt
From: Random on
On May 19, 1:30 pm, Piranha <eu_pira...(a)gmx.net> wrote:
> Is there a way in GetWindowRect() or GetClientRect() and MoveWindow()
> to do this, or how else can it be done?

None of those APIs care about the screen, they treat multiple monitors
as one large desktop. Perhaps with the exception of creating a
maximized window on the proper screen, you shouldn't have to worry
about it either. Can you show the code that's failing?
From: Piranha on
On 19 Mai, 22:37, Matt <matttel...(a)sprynet.com> wrote:
> On May 19, 2:30 pm, Piranha <eu_pira...(a)gmx.net> wrote:
>
> > I have an application that saves its window size and position into a
> > file upon close and reopens in the same position next time.
>
> > Unfortunately it doesn´t work on a dual screen system, no matter on
> > which screen the window is located before close, it always (re-)opens
> > on the 1st screen.
> > It does keep its position on the screen, it just doesn´t remember on
> > which screen it has been.
>
> > In other words, I need a way to include the screen identification into
> > the save of window position and upon reopen I have to MoveWindow()
> > onto the right screen.
>
> > Is there a way in GetWindowRect() or GetClientRect() and MoveWindow()
> > to do this, or how else can it be done?
>
> I suspect you need MonitorFromRect to determine which monitor the
> window is displayed upon.  Take a look at this link and see if it
> helps.
>
> http://msdn.microsoft.com/en-us/library/dd162826
>
> Matt

Thank you, that´s exactly what I needed.
I just didn´t know these functions exist, but now that I know, I
should be able to figure out the code myself.