From: Ajay Kalra on
If you are making this a plug-in and the host application is also MFC,
you should *not* be using a MFC Extension DLL because of likely
conflicts with other modules in the system. You should then resort to a
MFC Regular DLL which has its own set of resource IDs. You will need to
use AFX_MANAGE_STATE to change the state as needed.

Ajay Kalra

From: on
I am using this in an MFC application, so I'll need to use an MFC
Regular DLL. Can you recommend a good example or tutorial on how to do

From: Ajay Kalra on
I cannot think of a tutorial for this. All you really have to do it use
the wizard and let it spit out the code. Nothing more is really needed.
It even gives you hint about how to use AFX_MANAGE_STATE macros. There
may be some tutorial for it on Codeproject/Codeguru or MSDN. Sorry I am
not able to provide you specific links.

Ajay Kalra

From: on
No problem. You've already been really helpful and thanks again for all
of the help.

From: Joseph M. Newcomer on
I've done this for plugin technology; essentially, I defined a 2-way SendMessage interface
between the DLLs and the application. Then what I did was create a class

class CPlugin : public CDialog {
public: // methods to plugin
void SetBounds(int x, int y) { SendMessage(UWM_SET_BOUNDS, (WPARAM)x, (LPARAM)y);}
BOOL QuerySomeSetting() { return (BOOL)SendMessage(UWM_QUERY_SOME_SETTING); }

and I defined a set of messages that the plugin could send me. By hiding most of the
down-messaging in a class, I got a nicer interface. Then each plugin returned an object
of type CPlugin * instead of CDialog */

All messages were Registered Window Messages.

Messages received by the parent included messages like
* Inputs:
* WPARAM: (WPARAM)(UINT) MIDI code of noise to make
* LPARAM: (LPARAM)MAKELONG(volume, duration)
* Result: LRESULT
* Logically void, 0, always
* Effect:
* Plays a MIDI note at the indicated volume and duration

Then no matter what plugin I had, I had the same interface.

On 2 Feb 2006 09:18:45 -0800, "davejohansen(a)" <davejohansen(a)> wrote:

>Thanks for the advice. I am making this as sort of a plug-in system and
>so there will be different types of Dialogs that the original
>application will know nothing about before hand. If that's the case,
>can I still use an MFC Extension DLL and export the CDialog class for
>use in my main application? Because that definitely sounds like the
>better method.
>Also, is there an example or tutorial that you could point me to? I
>found this article:
>but it's pretty sparse on the details and there's no real example to
>show how it really works.
>Thanks a ton,
>Dave Johansen
Joseph M. Newcomer [MVP]
email: newcomer(a)
MVP Tips: