Author Topic: Working memory mapped file demo.  (Read 192 times)

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 4189
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Working memory mapped file demo.
« on: March 08, 2017, 03:10:23 PM »
Windows has had a method of transferring data between separate application for a very long time as shared memory created by a memory mapped file. The attached demo has the open and close procedures in a separate file so they can be reused, the code to run the MMF is marked with "' ***************" style block commenting through the app source code.

To test the demo, start up 2 instances of the application, load a text based file into one of the editors then click the green arrow on the toolbar and watch the data in the loaded editor transferred to the other instance of the editor. It works just as well on more instances, I tested it on 4 copies and its just as fast.

Memory mapped files are THE preferred technique to transfer data between apps within the operating system and it runs at memory read/write speed. The advantages of using the OS preferred method is both speed and size. This technique works fine on a gigabyte of data as long as you have the memory available.

To perform the signalling, you post a private message from the first app to the second. The example show how this is done and its simple enough API code.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin: