DuplicateHandle(), use in first or second process?

前端 未结 4 704
挽巷
挽巷 2021-01-13 04:01

The Windows API DuplicateHandle() http://msdn.microsoft.com/en-us/library/ms724251(VS.85).aspx Requires the Object handle to be duplicated and a handle to both the original

4条回答
  •  旧时难觅i
    2021-01-13 04:30

    If I understood correctly, you want to synchronize two unrelated processes through the same event. If so, you can use named events.

    Create one using CreateEvent API function, provide it a name, then from the second process use OpenEvent API function, specifying the name of the event.

    You have similar functions for other synchronization objects, such as mutexes (OpenMutex) or semaphores (OpenSemaphore).

提交回复
热议问题