Annotation of q_a/samples/othrproc/readme.txt, revision 1.1.1.1

1.1       root        1:  Sample: Sharing Named Memory Between Two Processes
                      2: 
                      3: Summary:
                      4: 
                      5: SHAREMEM and OTHRPROC are two samples which work together to
                      6: demonstrate sharing named memory between two separate
                      7: processes.  These samples must be run together.
                      8: 
                      9: More Information:
                     10: 
                     11: To use: first start an instance of SHAREMEM.  A window will
                     12: appear, devided into an upper and lower section.  The upper
                     13: section will have two edit fields: one displaying the mouse
                     14: pointer's X-coordinates, and the other the pointer's Y
                     15: coordinates, as the mouse moves in the lower section.
                     16: 
                     17: Start an instance of OTHRPROC.  Allow OTHRPROC to keep
                     18: focus, but move the pointer around over the SHAREMEM'S
                     19: window.  OTHRPROC has a similar window configuration;
                     20: however, you will notice that the X and Y coordinates of the
                     21: mouse as it moves over the SHAREMEM window are the values
                     22: that appear in the edit fields of OTHRPROC.  To emphasize
                     23: this, a cross hair will appear in OTHRPROC's lower section;
                     24: its movements relative to the mouse position in SHAREMEM's
                     25: window.
                     26: 
                     27: What's happening: When SHAREMEM is started, it creates a
                     28: allocates a piece of named shared memory the size of a DWORD
                     29: (the size needed to hold the mouse cursor's X and Y
                     30: coordinates) using CreateFileMapping.  As the mouse pointer
                     31: is moved across the window, the WM_MOUSEMOVE messages are
                     32: trapped, and the coordinates are written to the upper edit
                     33: fields and to the piece of named shared memory.
                     34: 
                     35: When OTHRPROC is started, it gets access to the named shared
                     36: memory by calling OpenFileMapping and MapViewOfFile.
                     37: OTHRPROC then uses a thread to pool and read the X and Y
                     38: coordinates written to the shared memory by SHAREMEM.  It
                     39: captures the coordinates and draws a bit map of a cross hair
                     40: in the specified location.
                     41: 
                     42: 
                     43: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.