如何在常规dll中创建主框架 [英] How to create a main frame in a regular dll

查看:125
本文介绍了如何在常规dll中创建主框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我想在dll中开发一个编辑器,但是在dll中创建主框架时遇到了问题.
我在 TN011:使用MFC作为DLL的一部分中提到了MSDN,然后发现了这句话:

Hi guys, I want to develop an editor in a dll, but I have a problem to create a main frame in a dll.
I referred to MSDN in TN011: Using MFC as Part of a DLL and I found this sentence:

Note that the CWinApp::Run mechanism does not apply to a DLL,
because the application owns the main message pump. If your DLL
displays modeless dialogs or has a main frame window of its own,
your application''s main message pump must call a DLL-exported
routine that calls CWinApp::PreTranslateMessage.



但是我不知道如何实现此例程,有人可以帮助我吗?



but I don''t know how to implement this routine, anybody can help me?

推荐答案

请参阅int CWinThread::Run()
举例来说,客户端(exe端)泵送例程:)

您保留注入" DLLs方法的调用,
执行DLL的CWinApp :: PreTranslateMessage(),
在那里(在EXEs循环内):)

由于每个您的客户端(DLL编辑器的)
将必须做到-

您是否已经回答过以下问题:
可以让您的DLL是MFC扩展的DLL
(以共享客户端应用程序对象)?:)
Please see int CWinThread::Run()
as an example clients (exe-side) pumping routine :)

You shold "inject" a call of DLLs method,
that perform the DLLs CWinApp::PreTranslateMessage(),
there (inside of EXEs loop) :)

Since each your client (of the DLLs editor)
will must do it -

have you already an answer for the question:
"May your DLL be an MFC-extended DLL
(to share the clients App-object) ?" :)


谢谢Eugen,:)

非常感谢您回答我的问题.

是的,我有一个解决我最后一个问题的方法,但是我不知道原因:
如何在具有doc/view的dll [
Thank you Eugen, :)

This is very kind of you to answering my questions.

Yes I have got a solution to my last problem but I don''t know the reason:
How to Create a CMDIFrameWnd in dll with doc/view[^]


如果您知道,
您所有的客户端都将是MFC EXE--

您可以使用MFC扩展的DLL(而不是常规DLL),
没有自己的应用程序实例的
(仅使用EXEs应用程序实例).

在这种情况下,您不需要
管理任何模块状态",消息重新控制",...:)
If you know,
that all your clients will be the MFC EXEs -

you could use an MFC-extended DLL (not a regular DLL),
that has not an own application instance
(only the EXEs application instance would be used).

In this case you would not need
to manage any "module state", "messages recontrolling", ... :)


这篇关于如何在常规dll中创建主框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆