这是库函数,不知道函数体是什么,函数用于初始化MFC.
CWinApp 调MFC支持的WinMain, WinMain自动调AfxWinInit 做初始化。
控制台程序不使用MFC支持的WinMain,所以要自己调用AfxWinInit来初始化MFC。
::GetModuleHandle 函数,取得当前模块的句柄 用作参数1。
参数2必须是NULL。
参数3取回命令行位置参数的函数,命令行 放入字符串。
一般程序,不用这个函数,或不需要自己调用这个函数。
win32中程序举例:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
// initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))//手动初始化MFC
{
// TODO: change error code to suit your needs初始化失败
cerr << _T("Fatal Error: MFC initialization failed") << endl;
nRetCode = 1;
return nRetCode;
}
else
{
nRetCode = Run ();//初始化成功执行别的程序
}
return nRetCode;
}
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。