DTdev
DTdev

Reputation: 562

WMP interfacace is blocking WMP from user interaction

My MFC program remotes a WMP instance to catch WMP events and is using IWMPCore, IWMPCore3, IWMPPlaylistCollection, IWMPMediaCollection to interact with WMP using COM. The remote instance is working find and it is avle to catch the events, but when I started fetching all the details of all songs(almost 5100 songs), WMP stops responding until my application fetches all the songs and release all the above instance. Can anyone please help me out with the issue and how can it be fixed?

Upvotes: 0

Views: 64

Answers (1)

Roman Ryltsov
Roman Ryltsov

Reputation: 69632

WMP ActiveX control is an STA COM object, so all interaction (method calls) goes through instantiation thread, which is in most cases the UI thread. That is, whatever you do with the interfaces, the calls block GUI for the time of the call.

You need to either pump window messages in the middle of your activity to unblock UI (show progress and let user hit Cancel button), or create a worker thread initialized as STA and obtain the collection details using a secondary invisible instance of WMP there.

Upvotes: 2

Related Questions