在Composite Control中创建无模式对话框 [英] Create modeless Dialog in Composite Control

查看:79
本文介绍了在Composite Control中创建无模式对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在MFC中,创建无模式对话框,例如

 CDialog * modelessDialog =  new  CDialog; 
modelessDialog->创建(IDC_DIALOG,



但在复合控制中,我想要创建modelss对话框,它不支持'this'参数,我该怎么办?

解决方案

这个问题毫无意义:this参数是指向传递给方法的实例。它不受支持或不受支持(例如方法);这是C ++和其他OO语言的一个特性。



代码示例也没有意义,因为this取决于上下文。这是传递给某些类/结构的某个外部方法的实例的指针。方法 Create 需要类型 CWnd 的第二个参数,如下面的代码示例所示:

http://msdn.microsoft.com/en-us/library/yhth57kd.aspx [ ^ ]。



你不能只是从它的上下文中删除一些代码片段,显示它并提出有关它的问题。您的this可以是任何类型的可以定义的(例如,在静态函数中,在不是任何类或结构的成员的函数中)。它与方法无关创建 - 上面引用的MSDN页面显示了它所期望的参数。



现在,回答你的问题:你能做什么?这很明显。首先,您应该停止尝试开发MCF应用程序,UI应用程序或任何其他高级内容;你还没有准备好。您需要从一开始就开始学习C ++和编程。您可以采取一些手册并按小步骤进行,完全理解每一步,尝试进行简单的练习,这最好是仅限控制台的应用程序。而且你应该改变你的学习方式。您应该停止复制您不理解的代码片段,并从头开始编写代码,了解您编写的每一行。您不应该跳过学习的主题和阶段。当你对基本​​编程感到非常自信,包括所有的OOP时,你可以回到UI开发或其他东西。



-SA

In the MFC ,Create modeless dialog ,such as

CDialog *modelessDialog = new CDialog;
modelessDialog->Create(IDC_DIALOG,this)


But in the Composite Control,I want to create modelss dialog,Which not support 'this' params,what can i do?

解决方案

The question makes no sense: "this" parameter is the pointer to the instance passed to the method. It cannot be supported or not supported (for instance methods); this is a feature of C++ and other OO languages.

The code sample also makes no sense, as "this" depends on the context. This is the pointer to the instance passed to some outer method of some class/structure. The method Create expects the second parameter of the type CWnd, as it is shown in this code sample:
http://msdn.microsoft.com/en-us/library/yhth57kd.aspx[^].

You cannot just rip some code fragment out of its context, show it and ask questions about it. Your "this" can be of any type of it may be defined at all (for example, in static functions, in functions which are not members of any class or structure). It has nothing to do with the method Create — the MSDN page referenced above shows what parameters it expects.

Now, to answer your question: what can you do? This is pretty obvious. First of all, you should stop trying to develop MCF applications, UI application or any other advanced stuff; you are not ready yet. You need to start learning C++ and programming, from the very beginning. You can take some manual and proceed in small steps, doing each step with full understanding, trying to do simple exercises, which would better be console-only applications. And also you should change your way of learning. You should stop copying code fragment you don't understand and start writing code from scratch, understanding each line you write. You should not skip topics and stages of your learning. And when you feel pretty confident in basic programming, including all of the OOP, you can get back to UI development or something else.

—SA


这篇关于在Composite Control中创建无模式对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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