How to share HGLOBAL with another application?

后端 未结 4 1657
遇见更好的自我
遇见更好的自我 2021-01-27 00:12

I\'m trying to understand something about HGLOBALs, because I just found out that what I thought is simply wrong.

In app A I GlobalAlloc() data

4条回答
  •  太阳男子
    2021-01-27 00:32

    Don't be confused with GMEM_SHARE flag. It does not work the way you possibly supposed. From MSDN:

    The following values are obsolete, but are provided for compatibility with 16-bit Windows. They are ignored.

    GMEM_SHARE
    

    GMEM_SHARE flag explained by Raymond Chen:

    In 16-bit Windows, the GMEM_SHARE flag controlled whether the memory should outlive the process that allocated it.

    To share memory with another process/application you instead should take a look at File Mappings: Memory-mapped files and how they work.

提交回复
热议问题