MFC Application Deployment [Step by Step Guide]

MFC Application Deployment [Step by Step Guide]

Hi everybody, We had gone through few hours before we figure out how to deploy an MFC based application for the ADP. Then later on we realized how simple it was to do so. Assumptions :- I assume that you might have already downloaded the Intel Atom SDK and installed on your PC. You are trying to compile your project using Visual Studio 2008. Although everything looks possible with Visual Studio 2005, but during linking it gives out an error, due to which you cannot proceed further. Step 1: Open your Stdafx.h Add the following lines just before your #pragma for Windows Common Controls #include "UnauthorizedException.h" #include "adpcppf.h" Step 2 Open the header file of your main application (where CWinApp is defined), add the following lines private: Application* m_pAdpObject; /** ADP application object. */ static ApplicationId m_sAppID; /** ID of your application from Intel Atom Site */ Step 3 :- We will create a new function to validate the AppID just before our application startup process. Lets add the function name in the header file. bool ValidateIntelObject(void); This function name can be anything as per your choice, I have just used a sensible name. Step 4 :- Now lets go to the main application CPP file, and initialize the APP ID ( right after your BEGIN_MESSAGE_MAP block) ApplicationId CYourMFCApp:: m_sAppID(ADP_DEBUG_APPLICATIONID); ADP_DEBUG_APPLICATIONID is the dummy id that you need to use for testing, once you are ready for deployment, you need to replace the ADP_DEBUG_APPLICATIONID with your application ID that you got from the Intel ADP site. CYourMFCApp:: CYourMFCApp() { m_pAdpObject = NULL; } Step 6 :- Now lets add the function that we have mentioned in the main application's header file bool CYourMFCApp::ValidateIntelObject(void) { bool bReturn = false; long ADPErrorCode = 0; try { m_pAdpObject = new Application(s_appId); bReturn = true; } catch (UnauthorizedException& ue) { ADPErrorCode = ue.code(); AfxMessageBox(_T("UnAuthorized Exception!"), MB_OK); bReturn = false; } catch (AdpException& e) { ADPErrorCode = e.code(); int response = AfxMessageBox(_T("ADP Exception!"), MB_OK); bReturn = false; } return bReturn; } Its a simple code, nothing much to explain, we are trying to create the object first, then we will catch the exception , depending upon the exception we notify the user about the error and return the status to the calling function. Step 7:- In the InitInstance() code of your application just after the CWinApp::InitInstance(); past the following code. if (! ValidateIntelObject()){ return false; } The above code will make the application exit, if there are any errors in Intel Object validation routine. If the validation is successful then the application will proceed to the normal routine. Thats all, now you have your application ready for the submission. We have submitted the application in this manner, not sure about the outcome, we are still in the approval process ;-) . Dont blame me if anything goes wrong by following this, I just wanted to share what we have gone through and how we have submitted the application. Any comments / suggestions welcome. Please correct me if i am wrong.... Thanks Thilak
2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

In the past I have faced some problems integrating alpha version of SDK with WTL app.
I will cross check if that problem is still faced with latest SDK-- and if necessary will post here.

Regards,

NS

Leave a Comment

Please sign in to add a comment. Not a member? Join today