Before I resigned, I was responsible for controlling the GSM module through serial port on the Windows CE system to implement general mobile phone functions. That is, the call, SMS, call record, Phone Book (SIM and mobile phone), and the setting part, such as on a general mobile phone, and then the multimedia part, for example, taking photos, recording, browsing pictures and some basic operations of camera, there are some small tools, such as mobile phone numbers, stopwatches, memos, etc.
There is also Windows CE system customization, as described in the preceding article.
In fact, programming is a very detailed problem, and it is generally found to find a solution. I have accumulated experience in solving the problem and now I have resigned. I want to sort out the problems and some content I encountered in my previous work. It is also a re-learning process for yourself. Here we mainly sort out the EVC programming-related parts, many of which were previously found on the Internet (hopefully there will be no infringement issues). If so, please contact me and I will handle them. Thank you !)
Today, we will first list a directory and then gradually improve it!
1) registry operations
2) GIF animation display class
3) timer Testing
4) keyboard hook
5) GSM module Problems
6) picture tour: cximage and voimage
7) mobile phone number attribution Query
This function is used to directly display the location of the phone number when calling a call. It also provides a small tool for users to enter their own numbers for query.
8) calendar and time controls
9) multi-language implementation
10) some ideas on interface implementation
11) processing of the Input Method Status Bar
12) calendar algorithm
13) Implementation of the camera function
14) recording (WAV) Format
15) GSM at command
Today, we can only think of so many things, and we will try to update them later.
Let's talk about the registry operation class, which has many implementations on the Internet. I also found a source code for CE registry operations on the Internet. The implementation style is similar to the Regedit style on the PC platform. You can find a reference!
(1) Contents of regclass. h:
# Ifndef gsmphone_reg_h
# Define gsmphone_reg_h
# Include "wtypes. H"
Class cregop
{
Public:
Bool deletekey (lpctstr szname );
Bool deletevalue (lpctstr szname );
Bool setmultisz (maid, maid );
Bool setbinary (lpctstr szname, lpbyte lpbvalue, DWORD dwlen );
Bool setdw (lpctstr szname, DWORD dwvalue );
Bool setsz (maid, maid );
Bool setsz (maid, maid );
DWORD getvaluedw (lpctstr szname, DWORD dwdefault = 0 );
Lpctstr getvaluesz (lpctstr szname );
Lpbyte getvaluebinary (lpctstr szname );
DWORD getvaluebinary (lpctstr szname, lpbyte lpbvalue, DWORD dwlen );
Bool getvaluesz (lpctstr szname, lptstr szvalue, DWORD dwlen );
Bool enumvalue (lptstr pszname, DWORD dwlenname, lptstr pszvalue, DWORD dwlenvalue );
Bool enumkey (lptstr psz, DWORD dwlen );
Bool isok ();
Operator hkey ();
Void reset ();
Cregop (hkey hkroot, lpctstr pszkey );
Bool open (hkey hkroot, lpctstr pszkey, regsam Sam = key_read );
Bool create (hkey hkroot, lpctstr pszkey );
Cregop ();
Virtual ~ Cregop ();
PRIVATE:
Hkey m_hkey;
Int m_index;
Lpbyte m_lpbvalue; // last value read, if any
};
# Endif // # ifndef gsmphone_reg_h
(2) Contents of regclass. cpp:
# Include "stdafx. H"
# Include "regclass. H"
// ================================================ ======================================
// Macro define
# Define myfree (p ){/
If (p) localfree (p );/
}
// ================================================ ======================================
/**///////////////////////////////////// //////////////////////////////////
// Construction/destruction
/**///////////////////////////////////// //////////////////////////////////
Cregop: cregop ()
{
M_hkey = NULL;
M_index = 0;
M_lpbvalue = NULL;
}
Cregop: cregop (hkey hkroot, lpctstr pszkey)
{
M_hkey = NULL;
M_index = 0;
M_lpbvalue = NULL;
Open (hkroot, pszkey );
}
Cregop ::~ Cregop ()
{
If (m_hkey)
{
Regclosekey (m_hkey );
}
Myfree (m_lpbvalue );
}
//-------------------------------------------------------------------
// Description:
// Create the key
//-------------------------------------------------------------------
Bool cregop: Create (hkey hkroot, lpctstr pszkey)
{
DWORD dwdisp;
Return error_success = regcreatekeyex (hkroot, pszkey, 0, null, reg_option_non_volatile, key_all_access, null, & m_hkey, & dwdisp );
}
//-------------------------------------------------------------------
// Description:
// Open the key
//-------------------------------------------------------------------
Bool cregop: open (hkey hkroot, lpctstr pszkey, regsam Sam)
{
Return error_success = regopenkeyex (hkroot, pszkey, 0, Sam, & m_hkey );
}
//-------------------------------------------------------------------
// Description:
// Reset the value
//-------------------------------------------------------------------
Void cregop: reset ()
{
If (m_hkey)
{
Regclosekey (m_hkey );
}
Myfree (m_lpbvalue );
M_hkey = NULL;
M_index = 0;
M_lpbvalue = NULL;
}
//-------------------------------------------------------------------
// Description:
// Operator overload
//-------------------------------------------------------------------
Cregop: Operator hkey ()
{
Return m_hkey;
}
//-------------------------------------------------------------------
// Description:
// Test whether is the handle of the key OK for next operate
//-------------------------------------------------------------------
Bool cregop: isok ()
{
Return m_hkey! = NULL;
}
//-------------------------------------------------------------------
// Description:
// Enum the key
//-------------------------------------------------------------------
Bool cregop: enumkey (lptstr psz, DWORD dwlen)
{
If (! M_hkey)
{
Return false;
}
Return error_success = regenumkeyex (m_hkey, m_index ++, psz, & dwlen, null );
}
//-------------------------------------------------------------------
// Description:
// Enum Registry Value
//-------------------------------------------------------------------
Bool cregop: enumvalue (lptstr pszname, DWORD dwlenname, lptstr pszvalue, DWORD dwlenvalue)
{
DWORD dwtype;
If (! M_hkey)
{
Return false;
}
Dwlenvalue * = sizeof (tchar); // convert length in Chars to bytes
Return error_success = regenumvalue (m_hkey, m_index ++, pszname, & dwlenname, null, & dwtype, (lpbyte) pszvalue, & dwlenvalue );
}
//-------------------------------------------------------------------
// Description:
// Get the string value
//-------------------------------------------------------------------
Bool cregop: getvaluesz (lpctstr szname, lptstr szvalue, DWORD dwlen)
{
If (! M_hkey)
{
Return false;
}
Dwlen * = sizeof (tchar); // convert length in Chars to bytes
Return error_success = regqueryvalueex (m_hkey, szname, null, null, (lpbyte) szvalue, & dwlen );
}
//-------------------------------------------------------------------
// Description:
// Get the binary value
//-------------------------------------------------------------------
DWORD cregop: getvaluebinary (lpctstr szname, lpbyte lpbvalue, DWORD dwlen)
{
If (! M_hkey)
{
Return false;
}
DWORD dwlenwant = dwlen;
If (error_success = regqueryvalueex (m_hkey, szname, null, null, lpbvalue, & dwlen ))
{
Return dwlen;
}
Else
{
Return 0;
}
}
//-------------------------------------------------------------------
// Description:
// Get the binary value
//-------------------------------------------------------------------
Lpbyte cregop: getvaluebinary (lpctstr szname)
{
Return (lpbyte) getvaluesz (szname );
}
//-------------------------------------------------------------------
// Description:
// Get the string value
//-------------------------------------------------------------------
Lpctstr cregop: getvaluesz (lpctstr szname)
{
Return 0;
}
//-------------------------------------------------------------------
// Description:
// Get the DWORD Value
//
// Parameters:
// Szname: [in] the value of registry
// Dwdefault: [in] the default value return when failed in getting
// DWORD Value.
//-------------------------------------------------------------------
DWORD cregop: getvaluedw (lpctstr szname, DWORD dwdefault)
{
If (! M_hkey)
{
Return false;
}
DWORD dwvalue = dwdefault;
DWORD dwlen = sizeof (DWORD );
Regqueryvalueex (m_hkey, szname, null, null, (lpbyte) & dwvalue, & dwlen );
Return dwvalue;
}
//-------------------------------------------------------------------
// Description:
// Set the string value
//-------------------------------------------------------------------
Bool cregop: setsz (maid, maid, DWORD dwlen)
{
// Prefix
If (! M_hkey)
{
Return false;
}
Return error_success = regsetvalueex (m_hkey, szname, 0, REG_SZ, (lpbyte) szvalue, sizeof (tchar) * dwlen );
}
//-------------------------------------------------------------------
// Description:
// Set the string value
//-------------------------------------------------------------------
Bool cregop: setsz (maid, maid szvalue)
{
Return setsz (szname, szvalue, 1 + lstrlen (szvalue ));
}
//-------------------------------------------------------------------
// Description:
// Get the DWORD Value
//-------------------------------------------------------------------
Bool cregop: setdw (lpctstr szname, DWORD dwvalue)
{
// Prefix
If (! M_hkey)
{
Return false;
}
Return error_success = regsetvalueex (m_hkey, szname, 0, REG_DWORD, (lpbyte) & dwvalue, sizeof (DWORD ));
}
//-------------------------------------------------------------------
// Description:
// Get the binary value
//-------------------------------------------------------------------
Bool cregop: setbinary (lpctstr szname, lpbyte lpbvalue, DWORD dwlen)
{
// Prefix
If (! M_hkey)
{
Return false;
}
Return error_success = regsetvalueex (m_hkey, szname, 0, REG_BINARY, lpbvalue, dwlen );
}
//-------------------------------------------------------------------
// Description:
// Set the multi value
//-------------------------------------------------------------------
Bool cregop: setmultisz (maid, maid, DWORD dwlen)
{
Return error_success = regsetvalueex (m_hkey, szname, 0, reg_multi_sz, (lpbyte) lpszvalue, sizeof (tchar) * dwlen );
}
//-------------------------------------------------------------------
// Description:
// Delete the value
//-------------------------------------------------------------------
Bool cregop: deletevalue (lpctstr szname)
{
// Prefix
If (! M_hkey)
{
Return false;
}
//
Return error_success = regdeletevalue (m_hkey, szname );
}
//-------------------------------------------------------------------
// Description:
// Delete key
//-------------------------------------------------------------------
Bool cregop: deletekey (lpctstr szname)
{
If (! M_hkey)
{
Return false;
}
Return error_success = regdeletekey (m_hkey, szname );
}