I’m playing with the FileMappingMBS class to use shared memory. Basically, for now, I want to have 3 fields (the app version and 2 “parameters”).
One process creates the shared memory like this:
if not SharedMemory.CreateSharedMemory("hiifh"+SearchID.ToString,40960) then MessageBox "Can't allocate shared memory." Return end if
No error is encountered. Next, some default values should be set. There lies my issue.
This is my test code:
if not (SharedMemory.SetSharedMemoryValue("Version",app.Version) or SharedMemory.SetSharedMemoryValue("SkipMethod","None") or SharedMemory.SetSharedMemoryValue("SkipPath","None")) then MessageBox "Can't set shared values." Return end if if not SharedMemory.HasSharedMemoryValue("Version") then MessageBox "Error 1." Return end if if not SharedMemory.HasSharedMemoryValue("SkipMethod") then MessageBox "Error 2." Return end if
When I run this, I get the MessageBox “Error 2.” and I’m puzzled; while the value “Version” is fine and remembered, the value “SkipMethod” has been forgotten, immediately after having been set.
Only the first memory value set was held. A bug in the plugin or something I don’t get?