Use MFC in ATL COM AppWizard projects and non-MFC projects

zhaozj2021-02-08  248

ATL WIZARD

Generated(

Executable

with

Service

The project is not allowed

MFC

Things, in order to increase the development efficiency and speed, everyone wants to use

MFC

. Therefore, give the following solution

:

1) First, in the STDAFX.H header file below two header files

#include

#include

2) The following code is added after _Twinmain () function to initialize the following code: You can use the classes in the MFC (in _module.dwthreadid = getCurrentThreadID (); then add appropriate)

IF (! Afxwininit (:: getModuleHandle (Null), NULL, :: getcommandline (), 0))

{

_Module.logevent (_t ("MFC Initialization Error!"), EVENTLOG_ERROR_TYPE);

Return 1;

}

This method can be applied to other non-MFC projects.

转载请注明原文地址:https://www.9cbs.com/read-1884.html

New Post(0)