tfinniga
tfinniga

Reputation: 6859

How can I communicate between two C++ MFC plugins?

I have a plugin for a c++ MFC app. I'm working with the developer of another plugin for the same app, that's trying to get notifications of events in my code. Both plugins are in the form of c++ dlls.

How can I pass messages from my plugin to his plugin? The solution needs to be robust to mismatched versions of our two plugins, as well as the host app. The notifications are during control point movement, so several times a second.

I could set up a callback mechanism, where upon load his plugin calls a function in my plugin with a function pointer. We're not guaranteed any loading order, but we could probably just check periodically.

I know Win32 has a messaging system, but I'm not sure how it works, really. We could add a hook, and I could send messages, but I'm a bit fuzzy on how we'd synchronize what the message id is, or any details other than what I said, really.

Any other ideas on how to do this?

Upvotes: 1

Views: 449

Answers (2)

ChrisW
ChrisW

Reputation: 56123

I'm a bit fuzzy on how we'd synchronize what the message id

Use the RegisterWindowMessage API.

Upvotes: 2

1800 INFORMATION
1800 INFORMATION

Reputation: 135463

Take a look at this article here, it shows the available IPC mechanisms in windows. I might try COM, Mailslots, Pipes or Shared Memory (file mapping) in your case, in addition to windows messages which you already mentioned.

Upvotes: 1

Related Questions