🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms.programmer
Article #2597

Re: New Instance x,y offset.

#2597
From: Risto Lankinen
Date: Mon, 13 May 1991 08:48
32 lines
2105 bytes
schansen@amc.com (Scott Hansen) writes:

>I have a relatively novice question in regards to multiple instances of
>a program.  I would like to offset each instance's x,y position when a
>new copy is executed.  It is easy to tell if multiple copies are running
>with 'hPrevInstance', but I what to be able to pass the previous intance's
>x,y to the new copy for offsetting.

>I tried using 'GetInstanceData()' but I don't think I fully understand its
>usage.  Any tips or suggestions would be greatly appreciated.

Hi!

Use the FindWindow() to get the hWnd of the previous instance, then use the
GetWindowRect() to find out its size.

Or, to use GetInstanceData() there must be a global variable of type RECT,
where an instance stores its size (using the GetWindowRect() ) each time it
gets a WM_SIZE message.  An instance being initialized copies the initial
values of the RECT by using the GetInstanceData(), creates its window using
these values' calculated offset{-s}.  A nice touch would be to read the RECT
initial values from a private profile file for the first instance without
offsetting them at all, to inherit the size from the application's latest
ancestor (being careful with the very first invocation of the application,
when there's no profile entry for the size at all).

Terveisin: Risto Lankinen
-- 
Risto Lankinen / product specialist ***************************************
Nokia Data Systems, Technology Dept *  2                              2   *
THIS SPACE INTENTIONALLY LEFT BLANK * 2 -1 is PRIME!  Now working on 2 +1 *
replies: risto@yj.data.nokia.fi     ***************************************
Technical Details
Message-ID: <1168@tuura.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!bloom-beacon!eru!hagbard!sunic!fuug!tuura!risto
References: <1991May9.190903.16601@amc.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!bloom-beacon!eru!hagbard!sunic!fuug!tuura!risto
From: risto@tuura.UUCP (Risto Lankinen)
Newsgroups: comp.windows.ms.programmer
Subject: Re: New Instance x,y offset.
Message-ID: <1168@tuura.UUCP>
Date: 13 May 91 08:48:53 GMT
References: <1991May9.190903.16601@amc.com>
Organization: Nokia Data Systems Oy
Lines: 32