|
|
1.1 root 1: Sample: Demonstrating how to share memory between processes.
2:
3: Summary:
4:
5:
6: The MEMORY sample demonstrates the use of the file mapping APIs
7: to create a share memory between processes.
8:
9: More Information:
10:
11: Server
12:
13: The "server" sets up the named share memory.
14:
15: A "server" can be created by selecting the Create.Server menu
16: item.
17:
18: This opens up a MDI child and swaps the menu bar to the
19: server menu bar.
20:
21: To set up the equivalent of a named share memory:
22:
23: 1. Select the Server.Create File... menu item.
24: This brings up the File Type dialog box. The user may create
25: either a memory page file or a physical file by clicking on
26: the Page File or the Map File button respectively to back up
27: the soon-to-be-created named share memory.
28:
29: If the Map File button is selected, the named shared memory
30: will be backed up by a physical file on the disk. On the
31: other hand, if the Page File button is clicked, the memory
32: will be backed up by the memory page file.
33:
34: 2. Select the Server.Create File Mapping... menu item.
35: This brings up the Map Name dialog box. The user then
36: specify a name for the memory map file object which will be
37: created for the file created in step 1 above.
38:
39: This name will be used to identify the shared memory by the
40: clients in the other processes.
41:
42: 3. Select the Server.Map View of File menu item.
43: This essentially maps the map file object created in step 2
44: above into the process's address space.
45:
46: 4. Select the Server.Access menu item.
47: This creates a MLE inside the MDI Server child. Whatever
48: written in the MLE is put in the map file object.
49:
50: Client
51:
52: The "client" connects to the named share memory created by
53: the server in another process.
54:
55: A "client" can be created by selecting the Create.Client menu
56: item.
57:
58: This opens up a MDI child and swaps the menu bar to the
59: client menu bar.
60:
61: To set up the connection to the named share memory:
62:
63: 1. Select the Client.Open File Mapping... menu item.
64: This brings up the Map Name dialog box. The user can then
65: enter the name of the map file object which client wanted
66: to connect to.
67:
68: 2. Select the Client.Map View of File menu item.
69: This essentially maps the map file object opened in step 1
70: above into the process's address space.
71:
72: 3. Select the Client.Access menu item.
73: This creates a MLE inside the MDI Server child. Whatever
74: got written in the map file object by the server will be
75: shown in this MLE.
76:
77: The client synchronizes with the server at a regular interval.
78:
79: 4. Select the Client.Refresh Now menu item refreshes the
80: contents of the map file object immediately.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.