Use C ++ for brew Programming

Source: Internet
Author: User
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

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.