2013年8月13日 星期二

MFC application in Windows Preinstallation Environment

There is a common issue when deploying Windows system via WinPE. Even though the deployment process is closed to automation, it still has some UI applications in WinPE, likes test tools or quality analyzers which are used by operator.

The later version of WinPE4.0 has .NET component that can be used basically .NET framework 4.0/4.5 function. But I believe unmanaged code is still mostly used for the simply operation system just like WinPE.

MFC is a popular and easy use for UI based unmanaged application, but when we create a basic MFC project using Visual Studio, then put the exe file to WinPE, it must be failed to launch. The problem was default MFC project will initialize ActiveX control container, so as to let developer using OLE objects.

So we want to use MFC application in WinPE, put the oledlg.dll and exe file together. The other way is remove AfxEnableControlContainer(); from the source code, if it does not have to use ActiveX controls.