11-01-2022 12:17 PM
I am getting the error "panel operation can be performed (if a top level) only in the thread in which the panel was created, or (if a child panel) only in the thread in which the top-level parent panel was created."
I am using CmtScheduleThreadPoolFunction twice in order to open two of the same panels but with different panel IDs. The second one closes fine with a quit callback but the first one produces the runtime error above. How do I get back to that thread in order to close it?
11-02-2022 02:44 AM - edited 11-02-2022 02:46 AM
An option could be to issue a PostDeferredCallToThread () and close the panel in the deferred callback. You'll need to get the thread ID by calling CmtGetCurrentThreadID () from within the thread and save it somewhere for this mechanism to work.
But you have to investigate on why the last call succeeds and the first one does not.