开发者

MFC GUI in main frame and other DLLs that nedd also GUI

I have a MFC application which has its GUI implemented as part of the executable code (view-doc 开发者_运维知识库architecture etc.) My application uses some DLLs I worte.

Now I have to write another DLL which I know it has to have a GUI as well.

My question/uncertainty is should I implement the GUI as part of the main application (main GUI) and connect between them OR should I implement a GUI as part of the new DLL and just make an entry point in main GUI ? In both cases it clear to me that I must have an interface class.

In case I implement a GUI as part of the DLL, it is clear to me that the GUI should hold a pointer to the interface class but how should the interface class talk with the GUI (e.g. notifies the GUI a long operation is completed or give the GUI intermediate reports about the operation ? 1) using pointer from Interface to GUI? 2) using message loop with callbacks? 3) other options???

Many Thanks


Generally, MFC + GUI stuff in DLL = much needless trouble. At least as I recall from ten+ years back. It has to do with MFC Microsoft-style "support" for something or other that someone at Microsoft imagined could be a problem, so MFC distinguishes between different kinds of DLLs and DLL states and whatnot, in particular with regard to resources.

So I'd say, for MFC, keep the GUI stuff in the main program, if at all practical.

It also has to do with allocation of responsibilities. By separating responsibilities you get a more clean design that is easier to maintain. Put knowledge of things where it's needed for the responsibilities.

Cheers & hth.,

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜