Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!swrinde!sdd.hp.com!spool.mu.edu!cs.umn.edu!msi.umn.edu!math.fu-berlin.de!fauern!unido!rwthinf!slcdec!hippo!f1.n6000.z2.fidonet.org!p1.f36.n245.z2.fidonet.org!Thomas_Hornschuh From: Thomas_Hornschuh@p1.f36.n245.z2.fidonet.org (Thomas Hornschuh) Newsgroups: comp.windows.ms.programmer Subject: Re: Global Memory Goes Away? Message-ID: <220690798@p1.f36.n245.z2.fidonet.org> Date: 14 May 91 19:25:19 GMT Reply-To: Thomas_Hornschuh%p1.f36.n245.z2@hippo.dfv.rwth-aachen.de (Thomas Hornschuh) Organization: Thomas Hornschuh, SoftStream 2, Dortmund (FRG) Lines: 18 Comment-To: Kevin_P._Kleinfelter@f1.n6000.z2.fidonet.org (Kevin P. Kleinfelter) KP> I allocate some memory with KP> "GlobalAlloc(GMEM_MOVEABLE|GMEM_ZEROINIT,2048)" KP> in instance 1 of my program. I store the handle to this memory in a KP> class extra word. Instance 2 shares this memory, by getting the handle KP> from KP> the class word. KP> KP> This works fine, until instance 1 terminates; at this point instance 2 KP> can no longer GlobalLock. It looks like Windows is calling GlobalFree KP> for me. Other than writing a DDE for sharable memory, how can I prevent KP> the KP> freeing and allow sharing? Windows discards (frees) all memory allocated by a task when the task terminates. The only way to allocate a "permanent" memoryblock is, wrting a special task that allocates and holds the sharable memory. You should communicate with this task over DDE-messages.