Extension classes are not used as independent applications, and mobile users cannot directly purchase, download, or delete them. Instead, they are processed in the internal environment of the application that uses the extension class. The extension class is a special application, which is equivalent to the library developed by the application developer. It is represented as a dll library on the PC and a mod execution file on the terminal.
There are two types of Extension applications: public extension and private extension. Public extension classes are developed and owned by developers and are provided to other developers for use and are charged. Private extension classes can be developed and owned by developers, used by one or more of their own applications, and shared with other applications. They can also be developed and owned by operators and released by carriers, provided to developers or partners. It can also be developed and owned by mobile phone manufacturers, released by mobile phone manufacturers, and used by partners.
When creating an extension class, pay attention to the implementation order. First, allocate memory, initialize the virtual table, and finally initialize the member variables and other required code. The example is as follows:
If (nsize <sizeof (myextension) nsize + = sizeof (myextension );
If (PME = (myextension *) malloc (nsize + sizeof (vtbl (imyextension) = NULL)
Return enomemory;
// Initialize the data members
PME-> m_nrefs = 1;
PME-> m_mydata1 = 0;
PME-> m_mydata2 = 0;
The implementation of other functions in the extension class is the same as that in common applications.
When using an extended class, it is equivalent to calling an interface. You only need to include the header file of the extended class, and then create an interface instance of the extended class to use the functions in the extended class normally. For example:
If (ishell_createinstance (PME-> m_pishell, aeeclsid_myextension, (void **) & pextcls ))
Return false;
Iextcls_myfunction1 (pextcls, 0 );
Iextcls_release (pextcls );
The communication between an application and an extension class is similar to the communication method between the application discussed earlier.