okee dokee...plain and simple:

The setup:
-one parent window
-one edit window as a child (WS_CHILD or ES_MULTILINE)
-one other child window

Here's what I want to do:
-have the edit window as a editor
-have the other child window use the text from edit window to draw things. Text needs to be parsed for commands

How I'm making it work:
-Every time I need to paint other child, I call GetWindowText on the Edit window and copy it to a buffer. Then I access the buffer.

Why this way is stupid:
-Doing it this way means I have the *same* text in memory twice. It also means I'm doing a lot of calls to GetWindowText that are probably unneccesary

What I need help with:
-I want to have the child window and edit control share a block of memory allocated by GlobalAlloc,GPTR. I tried using EM_SETHANDLE and EM_GETHANDLE and it works for awhile then dies. The edit control keeps the information but for some reason the other window loses it. i think the edit control is pulling something on me.

Can anyone give me some help? Can anyone give me a clue as to what's going on?

Thanks to all

--Chorus
Posted on 2002-04-20 19:16:42 by chorus
Are you locking the pointer returned by EM_GETHANDLE before using it?
Posted on 2002-04-20 20:03:53 by iblis
Hi Chorus,

Just another idea how to do this, if you haven't seen it yet you might want to take a look at the tutorial at Iczelions site by Aesculapius - Memory Mapped Files: Sharing Data Between Instances.

http://spiff.tripnet.se/~iczelion/files/mmf.zip

It looks like this might be an elegant way to share data between your windows and keep it safe from whatever is causing you problems.

Kayaker
Posted on 2002-04-20 23:13:16 by Kayaker
hi chorus
Another way you could do this is have your parent window process the EN_UPDATE or the EN_CHANGE messages so you only call GetWindowText when something has changed.
Posted on 2002-04-21 00:43:21 by Kudos