When AE (AO) is used in MFC for secondary development, if AE Runtime is not installed on the target machine, the program will be directly suspended.
In this caseCxxappOfInitinstance ()OfStarting PointAdd the environment detection code to prompt you to install the AE runtime.
The Code is as follows:
1 bool cmap2dapp: initinstance () 2 {3 coinitialize (null); 4 5 try 6 {7 iaoinitializeptr ipaoinitialize (clsid_aoinitialize); 8 If (ipaoinitialize = NULL) 9 {10 MessageBox (null, "Please install ArcGIS Engine runtime first! "," Map 2D ", mb_ OK | mb_iconexclamation); 11 couninitialize (); 12 Return false; 13} 14 esrilicensestatus licensestatus; 15 hresult hR = ipaoinitialize-> initialize (initialization, & licensestatus); 16 17 if (licensestatus! = Esrilicensecheckedout) 18 {19 MessageBox (null, "Please install ArcGIS Engine runtime first! "," Map 2D ", mb_ OK | mb_iconexclamation); 20 couninitialize (); 21 return false; 22} 23} 24 catch (...) 25 {26 MessageBox (null, "Please install ArcGIS Engine runtime first! "," Map 2D ", mb_ OK | mb_iconexclamation); 27 couninitialize (); 28 return false; 29} 30}