none
[c++] How to know how many instances are running in a multi-instance uwp project?

    Question

  • How to know how many instances are running in a multi-instance uwp project?

    Windows::ApplicationModel::AppInstance::GetInstances::Size can get the count, but have to register an instance, in my case, cannot register, is there any other way?

    Or how to implement reference counting like AppInstance? Increments the reference count is easy, but how to decrements the reference count? An instance can be closed by the user or it can be killed by the system (eg. throw an exception).

    Sunday, February 10, 2019 3:21 PM

All replies

  • Hello,

    Currently I'm not aware of such a way you want. Why you cannot register and what function do you want to have by knowing this?

    Best regards,

    Barry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, February 11, 2019 10:01 AM
    Moderator
  • I have used AppInstance for other features. I need to know the count because I need to synchronize the data between all instances. And skip data synchronization when there is only one instance.

    I have tried all the traditional methods. atexit, at_quick_exit, set_terminate, NtQueryObject...... All of this doesn't work or can't be used in a uwp project.

    • Edited by [-] Monday, February 11, 2019 12:55 PM
    Monday, February 11, 2019 12:46 PM