什么是MFC应用程序中的启动功能 [英] What's the Start Function in MFC Application

查看:61
本文介绍了什么是MFC应用程序中的启动功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个MFC应用程序,我想将代码集成到此应用程序。但这不是真的有效。当我在其他MFC应用程序上编写代码时(我正在创建一个App来测试此代码)。有效 !!!!!我认为在启动解决方案时,我的第一个应用程序会定义一些标题,或者lib或者其他东西。也许这会使程序无法正常工作。

感谢和最好的问候!



在其他C / C ++项目中,始终启动的函数是void main()或int main ();

但在MFC中,没有主要功能!!!!



我认为虚拟BOOL InitInstance ();在MySolustionName.cpp中

此函数调用Start表单?

I had a MFC Application, I want to integrated a code to This App. But It not true worked. When I writing the code on the Other MFC Application (A App I'm create to Testing this code). It worked !!!!! I think when start up Solution, The my 1st App is defind some header, or lib or something. Maybe It makes the program does not work properly.!
Thank and best Regards !

In Other C/C++ Project, The Function to start alway is void main(), or int main();
But in MFC, there don't having the main Function !!!!

I think the "virtual BOOL InitInstance();" in the MySolustionName.cpp
This Function's calling the Start form ?

推荐答案

这称为入口点:http://en.wikipedia.org/wiki/Entry_point [ ^ ]。



在Windows中,传统的入口点是 WinMain http: //msdn.microsoft.com/en-us/library/windows/desktop/ms633559%28v=vs.85%29.aspx [ ^ ]。



在MFC应用程序中,入口点隐藏在库中,据说在文件Appmodule.cpp中。实际上,入口点名称定义为 _tWinMain ,这是Unicode的通用名称(wide wWinMain )和非Unicode( WinMain )入口点名称,一种从Unicode选项中抽象出来的方法。



此CodeProject文章解释了它如何与MFC一起使用:引擎盖下的MFC [ ^ ]。



请参阅那么,好老的WinMain发生了什么?...... :-)







现在,一些高级背景信息:



我们可以看到基于PE文件的不同平台(http://en.wikipedia.org/wiki/Portable_Executable [ ^ ])我们e入口点函数的不同名称,并且对于不同的基于Windows的平台和/或框架,一个入口点函数调用另一个辅助入口函数,这是唯一暴露给框架用户的函数。我们可以对它进行全面调查,但它是否有意义?最终,即使是调用堆栈上的最顶层函数,真实入口点,也不必具有某个标准名称。这是因为真实入口点不是由名称找到的,而是由用于此目的的头结构中的地址找到的。请参阅:

http://en.wikibooks.org/wiki/X86_Disassembly/Windows_Executable_Files #PE_Optional_Header [ ^ ]。< br $>


-SA
This is called "entry point": http://en.wikipedia.org/wiki/Entry_point[^].

In Windows, the conventional entry point is WinMain: http://msdn.microsoft.com/en-us/library/windows/desktop/ms633559%28v=vs.85%29.aspx[^].

In an MFC application, the entry point is hidden in the library, reportedly, in the file "Appmodule.cpp". Actually, the entry point name is defined as _tWinMain, which is a generic name for Unicode ("wide" wWinMain) and non-Unicode (WinMain) entry-point names, a way to abstract out from Unicode option.

This CodeProject article explains how it works with MFC: MFC under the hood[^].

See the section "So, what happened to good old WinMain?"… :-)



Now, some advanced background information:

We can see that different platforms based on PE files (http://en.wikipedia.org/wiki/Portable_Executable[^]) use different names for entry-point functions, and also, for different Windows-based platforms and/or frameworks, one entry point function calls another "secondary" entry function which is the only one exposed to the framework user. We can investigate it all, but does it make much sense? Ultimately, even the very top function on the call stack, "real" entry point, does not have to have a certain standard name. This is so because that "real" entry point is found not by the name, but by the address in the header structure used for this purpose. Please see:
http://en.wikibooks.org/wiki/X86_Disassembly/Windows_Executable_Files#PE_Optional_Header[^].

—SA


这篇关于什么是MFC应用程序中的启动功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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