在主程序中加入下面代码:
HWND hWndInputPanel = NULL;
HWND hWndTaskBar = NULL;
HWND hWndSipButton = NULL;
RECT rtDesktop;
RECT rtNewDesktop;
//RECT rtInputPanel;
//RECT rtSipButton;
RECT rtTaskBar;
int InitFullScreen (void)
{
int Result = 0;
__try
{
if (SystemParametersInfo(SPI_GETWORKAREA, 0, &rtDesktop, NULL) == 1)
{
// Successful obtain the system working area (Desktop)
SetRect(&rtNewDesktop, 0, 0, CEP_SCREEN_WIDTH, CEP_SCREEN_HEIGHT);
// Change system setting
SystemParametersInfo(SPI_SETWORKAREA, 0, &rtNewDesktop, SPIF_UPDATEINIFILE);
}
hWndTaskBar = FindWindow(TEXT("HHTaskBar"), NULL);
// Checking...
if (hWndTaskBar != NULL)
{
// Get the original taskbar window size
GetWindowRect(hWndTaskBar, &rtTaskBar);
if (rtTaskBar.top >= CEP_SCREEN_HEIGHT)
{
rtTaskBar.top = CEP_SCREEN_HEIGHT - (rtTaskBar.bottom-rtTaskBar.top);
rtTaskBar.bottom = CEP_SCREEN_HEIGHT;
}
}
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
// PUT YOUR ERROR LOG CODING HERE
// Set return value
Result = 1;
}
return Result;
}
//显隐任务栏,隐藏时将任务栏窗口移到屏幕外面,显示时再移入
int DoFullScreen (bool mode)
{
int Result = 0;
__try
{
if (mode)
{
// Update window working area size
SystemParametersInfo(SPI_SETWORKAREA, 0, &rtNewDesktop, SPIF_UPDATEINIFILE);
if (NULL != hWndTaskBar)
{
// Hide the TaskBar
MoveWindow(hWndTaskBar,
0,
rtNewDesktop.bottom,
rtTaskBar.right - rtTaskBar.left,
rtTaskBar.bottom - rtTaskBar.top,
false);
}
}
else
{
// Update window working area size
SystemParametersInfo(SPI_SETWORKAREA, 0, &rtDesktop, SPIF_UPDATEINIFILE);
// Restore the TaskBar
if (NULL != hWndTaskBar)
{
MoveWindow(hWndTaskBar,
rtTaskBar.left,
rtTaskBar.top,
rtTaskBar.right - rtTaskBar.left,
rtTaskBar.bottom - rtTaskBar.top,
false);
}
}
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
// PUT YOUR ERROR LOG CODING HERE
// Set return value
Result = 1;
}
return Result;
}
在InitInstance(HINSTANCE hInstance, int nCmdShow)里加入
InitFullScreen();
在适当的地方加入
DoFullScreen(true/false);
l WinCE所有的字符串都用Unicode
WinCE不支持ANSI字符,统统都是unicode的,所以所的字符都得转化为Unicode,尤其是字符串常量,使用宏命名_T(“”)或L””比如:
CString str1=_T(“Hello World!”);
CString str2=L”Hello World!”;
l 怎样把整型变量转为CString?
CString m_str;
m_str.Format(_T(“%d”),m_val);
同样,使用format格式化字符串,可以把多种类型转换为CString。
l 怎样获得对话框上面的控件的对象?
使用GetDlgItem方法,例如:
( (CWnd* )GetDlgItem( IDC_BTN_OK ) )->ShowWindow( true );
l 怎样获得系统当前时间?
CTime curTime = CTime::GetCurrentTime();
char showTime[10];
sprintf(showTime,"%d:%d:%d",curTime.GetHour(),curTime.GetMinute(),curTime.GetSecond());
也可以:
CTime curTime = CTime::GetCurrentTime();
CString showTime;
showTime.Format(L"%d:%d:%d",curTime.GetHour(),curTime.GetMinute(),curTime.GetSecond());