The Qualcomm SDK teaches us how to create a project using C language by default, but sometimes it is easier to use C ++. This article describes how to build a C ++ framework in brew.
1. First, create a project using the Qualcomm method, and name it"
Test", So that the generated project will automatically generate"
Test. c"File. 2. Create a project header file named "test. H", which implements a class
TestcppThe Code is as follows: Class
Testcpp: Public aeeapplet // The class must inherit from aeeapplet {public: static Boolean handleevent (testcpp * ptestcpp, aeeevent ecode, uint16 wparam, uint32 dwparam); protected: // Add your codes here}; 3. Set "test. c. CPP, and then in "test. make the following changes in the CPP file: ① the original int aeeclscreateinstance function is changed to the following: extern "C" int aeeclscreateinstance (aeeclsid CLSID, ishell * pishell, imodule * pimodule, void ** ppapplet) {aeeapplet * PME = 0; * ppapplet = NULL; If (CLSID =
Aeeclsid_test) // Your classid {If (! Aeeapplet_new (sizeof (
Testcpp), CLSID, pishell, pimodule, (iapplet **) ppapplet, (aeehandler)
Testcpp: Handleevent, null) return efailed; PME = (aeeapplet *) (* ppapplet); If (! PME) Return (efailed); Return (SUCCESS);} else return (efailed);} ② originally static Boolean
TestThe _ handleevent function is changed to the following: Boolean
Testcpp: Handleevent (
Testcpp* Papp, aeeevent ecode, uint16 wparam, uint32 dwparam) {aechar text [] = l "Hello brew C ++"; aeeapplet * PME = (aeeapplet *) PAPP; switch (ecode) {Case evt_app_start: // Add your code here ..... idisplay_drawtext (PME-> m_pidisplay, aee_font_large, text,-1, 0, 0, null, idf_align_center | cursor); idisplay_update (PME-> m_pidisplay); Return (true ); case evt_app_stop: // Add your code here ..... RET Urn true; default: break;} return false;} ③ compile and run the program. You will see "Hello brew C ++" in the middle of the screen. Performance_^ congratulations! Retained the following information:
Author (author): smilelance
Time: 2006.09.28
Source (from): http://blog.csdn.net/smilelance