News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Question about memory mapped files.

Started by xanatose, October 12, 2011, 07:58:54 PM

Previous topic - Next topic

xanatose

I am using memory mapped file to share memory between 2 applications. It does it work, but I want to know if there is a way for Application A receive a notification when Application B have written to the file (and what area of the file was changed).

Basically what I have in the mapped file is an array of 256 strings of exactly 256 bytes each. I want to know when each string have change.

I can think of sending a message to the window of the process, but wonder if there is another way.

jj2007

WM_COPYDATA is the standard method. You can send it from a console app, too, but of course a console cannot receive it.
By the way, you can also hand over a dword as wParam of a WM_TIMER message... not really documented but it works :bg

dedndave

Quoteyou can also hand over a dword as wParam of a WM_TIMER message

cool trick   :bg

you could also register a custom user-defined message

clive

It could be a random act of randomness. Those happen a lot as well.

jj2007

#4
Quote from: dedndave on October 12, 2011, 09:28:51 PM
you could also register a custom user-defined message

or take WM_DROPFILES - works fine for a few kBytes :bg

Actually, on Win XP SP3, the "few kBytes" are exactly 624 - I pasted the complete Windows.inc into a tuned edit control, and sent it via WM_DROPFILES to another app where 638,975 bytes arrived as "first filename" ::)