According to http://vb.mvps.org/hardcore/html/sha...appedfiles.htm if you pass -1 to the hFile parameter in the CreateFileMapping API function, you will "create a file mapping that isnt mapped to a file". However it doesn't explain what exactly to do to close it. When you If you pass an actual file handle to hFile (previously created with the CreateFile API function), you can close it later with CloseHandle API function, and presumably this also destroys the associated shared memory space from the CreateFileMapping API function as well.
However, what do you do to deallocate shared memory that is NOT associated with a file handle, like when you pass -1 to the hFile parameter of the CreateFileMapping API function? The above linked tutorial does NOT TELL YOU HOW TO DO THIS. As such it is not a really good tutorial, it says how to set up some shared memory that is not associated with a file handle by passing -1 to the function, but then neglects to say HOW TO DEALLOCATE THAT MEMORY when you no longer need it.
Hopefully some highly advanced VB programmers on this forum will be able to fill in info for me on this majorly important step of deallocating this memory, something that the tutorial on the other forum, mysteriously COMPLETELY LEFT OUT (despite the major importance of it).
However, what do you do to deallocate shared memory that is NOT associated with a file handle, like when you pass -1 to the hFile parameter of the CreateFileMapping API function? The above linked tutorial does NOT TELL YOU HOW TO DO THIS. As such it is not a really good tutorial, it says how to set up some shared memory that is not associated with a file handle by passing -1 to the function, but then neglects to say HOW TO DEALLOCATE THAT MEMORY when you no longer need it.
Hopefully some highly advanced VB programmers on this forum will be able to fill in info for me on this majorly important step of deallocating this memory, something that the tutorial on the other forum, mysteriously COMPLETELY LEFT OUT (despite the major importance of it).