第一次启动MFC,想要一点帮助!!请!! [英] Beginning MFC for the first time and would like a little help!! Please!!

查看:75
本文介绍了第一次启动MFC,想要一点帮助!!请!!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我的最后一个问题有点含糊.我可以用C/C ++/COBOL/HTML/VB/FORTRAN编写,但我还涉猎了其他一些内容.我只需要一些帮助来学习Windows编程方式.几乎任何人都可以使用MS Visual Studio 2010创建MFC项目,但是我很难将其包裹起来.我在互联网和论坛之后的论坛中搜索答案,但还是一头雾水.如果创建一个用于创建简单电话簿程序的SDI项目之后,一些好心人会告诉我下一步.我可以用C ++/CLI编写程序,但是我不知道如何将其合并到Windows程序中.我将以一百万美元的价格向某人展示如何做到这一点.

I guess my last question was a little too vague. I can write in C/C++/COBOL/HTML/VB/FORTRAN and I dabble in a few others. I just need some help learning the Windows way of programming. Almost anyone can create an MFC project using MS Visual Studio 2010, but I''m having trouble wrapping my head around it. I searched the Internet and forum after forum for answers, but still empty headed. If some good hearted person(s) would show me the next steps after creating an SDI project for creating a simple phonebook program. I can write the program in C++/CLI, but I have NO idea how to incorporate this into a windows program. I would ALMOST pay someone a million dollars to show me how to do this. PLEASE and THANK YOU!

推荐答案

这是一个非常广泛的问题...但这是要点.

嗯,MFC是一个围绕WinAPI的面向对象的框架.本质上,它可以为您自动完成一些事情,最重要的部分是在启动时作为Windows进程注册并创建入口点(您也可以不使用MFC来完成).如果您告诉VS2010您要构建MFC应用程序,它将为您从CWinApp(包含InitDialog(),您在其中启动与应用程序相关的所有内容)派生的基线创建一个基线,该类执行一堆为您加上的初始化会创建一个消息泵,以便您可以向/从应用发送消息.从那里开始,它取决于应用程序的类型进行分支.最简单的可能是基于对话框的应用程序.它由一个CWinApp和一个通常从CDialog()派生的对话框组成.对话框类用于封装所有与GUI相关的控件.如果要构建第一个MFC应用程序,建议从对话框应用程序开始.

[edit]
...您可以使用向导来帮助您从对话框开始,但从长远来看,请确保您了解它为您提供的代码,这将使您的生活更轻松.一段时间后,您可以手动完成所有操作(如果您要进行可以支持的广泛开发,那么最终还是要这样做.)
[/edit]

[edit2]
并且在它被误解之前,MFC是一个框架,不一定只是WinAPI的包装器.因此,它为构建应用程序(如Qt或其他框架)提供了基准.
[/edit2]
This is a really broad question... but here''s the gist of it.

Well, MFC is an object oriented framework that wraps around the WinAPI. Essentially it does a few things auto-magically for you, the most essential parts being registering as a process with Windows upon startup and creates an entry point (which you can do without MFC as well). If you tell VS2010 that you want to build an MFC app, it''ll create a baseline for you derived from CWinApp (which contains InitDialog(), where you start everything related to your app), an MFC class that does a bunch of initialization for you plus creates a message pump so that you can message to/from the app. From there, it sort of branches depending on what type of app it is. The simplest is probably the dialog based application. It consists of a CWinApp and a dialog typically derived from CDialog(). The dialog class is meant to enclose all GUI related controls. If you''re going to build your first MFC app, I''d recommend starting with a dialog application.

[edit]
...You can use the wizard to help you start off with a dialog but make sure you understand the code that it put in for you, in the long run, that''ll make your life way easier. After a while you can do everything by hand (which is what you want to end up doing anyway if you''re going to do extensive development that you can support).
[/edit]

[edit2]
And before it gets misinterpreted, MFC is a FRAMEWORK, not necessarily just a wrapper on WinAPI. So it provides a baseline for building applications much like Qt or other frameworks would.
[/edit2]


这篇关于第一次启动MFC,想要一点帮助!!请!!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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