Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!microsoft!kensy From: kensy@microsoft.UUCP (Ken SYKES) Newsgroups: comp.windows.ms.programmer Subject: Re: New Instance x,y offset. Message-ID: <72331@microsoft.UUCP> Date: 13 May 91 23:28:53 GMT References: <1991May9.190903.16601@amc.com> Reply-To: kensy@microsoft.UUCP (Ken SYKES) Organization: Microsoft Corp., Redmond WA Lines: 23 In article <1991May9.190903.16601@amc.com> schansen@polaris.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. > >-Scott Here is how GetInstanceData works. A given program has a set of variables in its data segment (its globals). The thing to note is the OFFSET of a variable in a data segment remains the same, regardless of the number of instances. So GetInstanceData allows you to copy global variable's contents from one instance to another by specifying the instance (to establish the data segment) and the address of the global (to establish the offset.) Make sense? Ken Sykes Disclaimer: The above opinions are solely my own.