home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / winbase / memory / readme.txt < prev   
Text File  |  1996-01-17  |  3KB  |  66 lines

  1. How to Share Memory Between Processes.
  2.  
  3.  
  4. SUMMARY
  5. =======
  6.  
  7. The MEMORY sample demonstrates the use of the file mapping functions to 
  8. create named shared memory.
  9.  
  10. MORE INFORMATION
  11. ================
  12.  
  13. This sample consists of a client and a server.
  14.  
  15. Server
  16. ------
  17.  
  18. The server sets up the named share memory. A server can be created by 
  19. selecting Server from the Create menu. This opens up a MDI child and swaps 
  20. the menu bar to the server menu bar. To set up the equivalent of a named 
  21. shared memory:
  22.  
  23.   - Select Create File from the Server menu. This brings up the File Type 
  24.     dialog box. The user may create either a memory page file or a physical 
  25.     file by clicking on the Page File or the Map File button respectively to 
  26.     back up the soon-to-be-created named shared memory. If the Map File 
  27.     button is selected, the named shared memory will be backed up by a 
  28.     physical file on the disk. On the other hand, if the Page File button 
  29.     is clicked, the memory will be backed up by the memory page file.
  30.  
  31.   - Select Create File Mapping from the Server menu. This brings up the Map 
  32.     Name dialog box. The user then specifies a name for the file-mapping 
  33.     object which will be created for the file created in step 1 above. This 
  34.     name will be used to identify the shared memory by the clients in the 
  35.     other processes.
  36.  
  37.   - Select Map View of File from the Server menu. This maps the file-mapping 
  38.     object created in the step above into the process virtual address space.
  39.  
  40.   - Select Access from the Server menu. This creates a MLE inside the MDI 
  41.     Server child. Whatever was written in the MLE is put in the map file 
  42.     object.
  43.  
  44. Client
  45. ------
  46.  
  47. The client connects to the named shared memory created by the server 
  48. process. A client can be created by selecting Client from the Create menu. 
  49. This opens up an MDI child and swaps the menu bar to the client menu bar. To 
  50. set up the connection to the named share memory:
  51.  
  52.   - Select Open File Mapping from the Client menu. This brings up the Map 
  53.     Name dialog box. The user can then enter the name of the file-mapping 
  54.     object which the client wanted to connect to.
  55.  
  56.   - Select Map View of File from the Client menu. This maps the file-mapping
  57.     object opened in the step above into the process virtual address space.
  58.  
  59.   - Select Access from the Client menu. This creates a MLE inside the MDI 
  60.     Server child. Whatever was written in the file-mapping object by the 
  61.     server will be shown in this MLE. The client synchronizes with the 
  62.     server at regular intervals.
  63.  
  64.   - Select Refresh Now from the Client menu to refresh the contents of the 
  65.     file-mapping object immediately.
  66.