我该如何进行这个计划?
我有一个程序,有很多 .cpp、.h 和 .dfm 文件。我最近刚刚开始学习 Visual C++ 和 MFC。该程序没有任何 .ncb 或解决方案目标文件,因此我无法理解如何开始理解该程序。有很多很多的文件,理解流程非常混乱。 还有两个文件夹。一个包含 .ac 文件,另一个包含文本文件。有人可以建议我一种更简单的开始方法吗?最终,在查看该程序的代码后,我必须创建自己的程序,该程序与此类似,但具有附加功能。
请帮忙。
干杯。
I have a program that has a lot of .cpp, .h and .dfm files. I have just recently started learning about Visual C++ with MFC. The program doesn't have any .ncb or solution object files, because of which I am unable to understand as to how to start understanding the program. There are lots and lots of files and its quite confusing to understand the flow.
There are two folders as well. One with .ac files and the other with text files. Could anyone suggest me an easier way to start off? Eventually, after looking at this program's code, I have to create my own program which is kind of similar to this but with added functionality.
Kindly help please.
Cheers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
虽然我不使用 C++ Builder,但
.dfm
建议它适用于 Visual C++ 以外的其他 IDE。我的提示是:.SLN
、.DSW
、.VCPROJ
、.DFM
CWnd
、CWinApp
、InitInstance
、CString
、< >OnInitDialog,BEGIN_MESSAGE_MAP
、ON_WM_
、afx_msg
等。main
或WinMain
code> - 程序从InitInstance
开始。大型VC++项目的知识很难掌握,而且对于初学者来说理解MFC代码会很麻烦!
While I dont use C++ Builder, but
.dfm
suggest it is for other IDE than Visual C++. My hints would be:.SLN
,.DSW
,.VCPROJ
,.DFM
CWnd
,CWinApp
,InitInstance
,CString
,OnInitDialog
,BEGIN_MESSAGE_MAP
,ON_WM_
,afx_msg
etc.main
orWinMain
- program starts atInitInstance
.It is hard to gain knowledge of big VC++ project, and understanding MFC code would be quite troublesome for beginner!
一些提示:
使用“在文件中查找”按钮查找字符
main
。如果您找到 main()、_tmain() 或 WinMain,这将告诉您很多有关您拥有的内容的信息。如果有一个 exe 文件,请运行它 - 这也会告诉您要查找的内容。Visual Studio 2010 可以选择从源文件创建解决方案,因此这也可能对您有所帮助。
如果您认为它是一个 MFC 应用程序,请查找 View 类、Document 类等。
在 Visual Studio 2010 中,导航至 (Ctrl,) 非常有用 - 在搜索词中使用大小写混合的单词将进行非常聪明的搜索。因此,如果您运行它并看到标有“打开策略”的按钮,那么您使用“导航到”搜索“OpenPolicy”,它将找到“PolicyOpen”和“OpenNewPolicy”以及更多“在文件中查找”找不到的内容。
祝你好运!
Some tips:
Use the Find in Files button to find the characters
main
. If you find a main(), an _tmain(), or a WinMain this will tell you a lot about what you have. If there's an exe, run it - that will show you what to look for also.Visual Studio 2010 has an option to create a solution from source files, so that may also help you.
If you think it's an MFC app, look for the View class, the Document class and so on.
In Visual Studio 2010 Navigate To (Ctrl ,) is super helpful - using mixed case words in your search term will do a very clever search. So if you run it and see a button labelled Open Policy, then you search with Navigate To for OpenPolicy, it will find PolicyOpen and OpenNewPolicy and plenty more that Find in Files would not.
Good luck!
人们正在回答该项目使用什么 IDE,我认为弄清楚这一点并不能帮助您了解项目中发生的情况。
为了阅读该项目,我可能遵循的路径是作为调试器通过 WinMain 中的调用,您需要一步一步地查看实际发生的情况。不是广告,但我发现 Source Insight 对于阅读大量源文件很有帮助。或者,如果您熟悉 cygwin,基本的“find & grep”也是方便但功能强大的工具,可以帮助您浏览源文件。
学习MFC,我自己的学习经验就是创建简单的项目,自己写代码。不要太依赖IDE,虽然它有一些花哨的自动化功能,比如双击UI设计视图中的控件,它会自动为你生成消息处理程序,但恕我直言,它并不能帮助你理解MFC是如何注册的/ 处理此消息。编写您自己的消息处理程序并手动注册它,将使您更好地了解它的工作原理和原理。
希望这有帮助。
People are answering what IDE the project uses, I don't think figuring that out helps you understand what's going on in the project.
For reading the project, the path I might follow would be go through the calls in WinMain as a debugger, you need to go step by step to see what actually happens. Not Ad, but I find Source Insight is helpful on reading bunches of source files. Or if you're familiar with cygwin, the basic "find & grep" is also handy but powerful tools to help you go through source files.
To learn MFC, my own learning experience is create simple project and write code yourself. Don't rely too much on the IDE, although it has some fancy automation staff, such as double clicking on the control in UI design view and it automatically generates message handlers for you, but IMHO it does not help you to understand how MFC registers/handles this message. Write your own message handler and register it manually, will give you a better idea on why and how it works.
Hope this helps.
在 Visual Studio 中创建新项目,然后将该文件添加到项目中。然后按 CTRL+F5 并构建项目。
Create new Project in Visual Studio and then add that files to project.. then press CTRL+F5 and Bulid Project.