请教,如何通过更WinCE shell下的taskbar.cpp去掉任务栏(不是隐藏,而是去掉)
[复制链接]
代码如下:
请做过的帮忙看看,没做过的达人们提提建议和思路,总之,欢迎多发言。先谢过!
extern CTaskBar *g_TaskBar;
extern CDesktopWnd *g_Desktop;
HWND Taskbar_GetWindow()
{
return g_TaskBar->GetWindow();
}
TCHAR const c_szExplorer[] = TEXT("Explorer");
TCHAR const c_szClock[] = TEXT("Software\\Microsoft\\Clock");
TCHAR const c_szShellKeys[] = TEXT("Software\\Microsoft\\Shell\\Keys");
TCHAR const c_szShellAutoHide[] = TEXT("Software\\Microsoft\\Shell\\AutoHide");
TCHAR const c_szShellOnTop[] = TEXT("Software\\Microsoft\\Shell\\OnTop");
TCHAR const c_szShowClock[] = TEXT("SHOW_CLOCK");
TCHAR const c_szExpandControlPanel[] = TEXT("ExpandControlPanel");
TCHAR const c_szRunHistory[] = TEXT("Explorer\\RunHistory");
TCHAR const c_szPower[] = TEXT("Software\\Microsoft\\Power");
TCHAR const c_szShowPower[] = TEXT("ShowIcon");
TCHAR const c_szShowPowerWarnings[] = TEXT("ShowWarnings");
TCHAR const c_szExplore[] = TEXT("Explore");
#define ADMIN_TIMER_PERIOD 30*1000
TCHAR const c_szMinimize[] = TEXT("Minimize");
TCHAR const c_szMaximize[] = TEXT("Maximize");
TCHAR const c_szControlPanel[] = TEXT("control.exe");
TBITEMINFO const tbitems[]= {
{ NULL, HHTBS_BUTTON, {0, TOPLINE, 52, BOTTOMLINE},HHTB_START, 0, TEXT("") },
{ NULL, HHTBS_STATUS, {0, TOPLINE, 0, BOTTOMLINE},HHTB_TRAY, 0, TEXT("") },
{ NULL, HHTBS_BUTTON, {0, TOPLINE, 0, BOTTOMLINE},HHTB_DESKTOP,0, TEXT("") },
{ NULL, HHTBS_BUTTON, {0, TOPLINE, 0, BOTTOMLINE},HHTB_SIP, 0, TEXT("") },
{ NULL, HHTBS_BUTTON, {0, TOPLINE, 0, BOTTOMLINE},HHTB_EXTRA, 0, TEXT("") }
};
extern HINSTANCE g_hInstance;
HRESULT SHRegQuerySZEx(HKEY hkeyRoot,
LPCTSTR lpszKey,
LPCTSTR lpszValue,
LPTSTR lpszVal,
UINT cch)
{
DWORD dwType, dw;
LONG lRet;
if (lpszKey == NULL) {
return E_INVALIDARG;
}
dw = cch * sizeof(TCHAR);
lRet = RegQueryValueEx(hkeyRoot, lpszValue, (LPDWORD)lpszKey, &dwType,
(LPBYTE)lpszVal, &dw);
return (ERROR_SUCCESS == lRet) ? NOERROR: E_FAIL;
}
LPTSTR rgSystemProcesses[] = { L"device.exe", L"gwes.exe", L"nk.exe", L"filesys.exe", L"services.exe", 0 };
........
CTaskBar::CTaskBar()
{
m_fShowClock=TRUE;
GetDisplayPowerSettings( &m_fShowPower, &m_fShowPowerWarnings );
m_dwMainVLowStart = 0;
m_dwBackupVLowStart = 0;
m_bExpandControlPanel = FALSE;
m_bTaskBarAbortHide = FALSE;
m_bTaskBarSlide = TRUE;
m_bTaskBarTameStartMenu = FALSE;
m_bInPopupMenu = FALSE;
m_bInExtrasMenu = FALSE;
m_bInSipMenu = FALSE;
m_currentNumberOfApps = 0;
m_indexFirstApp = 0;
m_firstNotifyToDisplay = 0;
m_fTaskbarDisabled = FALSE;
m_hwndDisablerWindow = NULL;
m_fIsSmallScreen = FALSE;
m_pBubbleMgr = NULL;
HKEY hkey;
LONG l;
DWORD dw = 0;
DWORD dwSize = sizeof(DWORD);
if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("Explorer"), 0,0,&hkey))
{
l = RegQueryValueEx(hkey, TEXT("QVGA"), NULL, NULL, (LPBYTE) &dw, &dwSize);
if ( l == ERROR_SUCCESS )
{
m_fIsSmallScreen = ( dw != 0 );
}
RegCloseKey( hkey );
}
if(m_fIsSmallScreen)
{
m_maxNotifysToDisplay = 2;
m_maxAppsToDisplay = 1; // can be zero
m_hfont = GetTBFont(12);
m_fExtraAppsButton = TRUE; // display a button for other apps
m_fShowDesktopButton = FALSE;
m_fShowSipButton = TRUE;
SEPERATOR = 2;
NUMITEMS = 1;
}
else
{
m_maxNotifysToDisplay = 16384; // something very large (to prohibit the spinn buttons)
m_maxAppsToDisplay = 16384; // some large upper bound
m_fExtraAppsButton = FALSE; // don't display a button for other apps
m_fShowDesktopButton = TRUE;
m_fShowSipButton = TRUE;
SEPERATOR = 2;
NUMITEMS = 3;
}
m_fShowSipButton = m_fShowSipButton && SIP_HaveSip();
}
CTaskBar::~CTaskBar()
{
Cleanup();
}
void CTaskBar::Show(HWND hwnd)
{
KillTimer(m_hwndTaskBar, IDT_AUTOUNHIDE);
if (m_bTaskBarHidden)
{
RECT rc;
rc.left = 0;
rc.right = GetSystemMetrics(SM_CXSCREEN);
rc.bottom = GetSystemMetrics(SM_CYSCREEN);
rc.top = rc.bottom - TASKBAR_HEIGHT;
m_bTaskBarHidden = FALSE;
ShowWindow(m_hwndTray, SW_SHOWNORMAL);
SlideWindow(m_hwndTaskBar, rc, TRUE);
if (m_bTaskBarAbortHide)
{
m_bTaskBarHidden = FALSE;
ShowWindow(m_hwndTray, SW_SHOWNORMAL);
}
if (m_bHasMouse)
SetHideTimer();
}
m_bTaskBarAbortHide = FALSE;
}
void CTaskBar::Hide(HWND hwnd)
{
POINT pt;
RECT rc;
BOOL b1 = GetCursorPos(&pt), b2 = GetWindowRect(hwnd, &rc);
BOOL b3 = InflateRect(&rc, 6, 6);
BOOL b4 = PtInRect(&rc, pt);
DEBUGMSG(1, (L"HIDE: %d, %d, %d, %d - (%d, %d) - (%d, %d, %d, %d)\r\n",
b1, b2, b3, b4,
pt.x, pt.y, rc.left, rc.top, rc.right, rc.bottom));
if (m_bInPopupMenu ||
(GetCursorPos(&pt) &&
GetWindowRect(m_hwndTaskBar, &rc) &&
InflateRect(&rc, 6, 6) &&
PtInRect(&rc, pt)))
{
if (m_bHasMouse)
SetHideTimer();
return;
}
KillTimer(m_hwndTaskBar, IDT_AUTOUNHIDE);
KillTimer(m_hwndTaskBar, IDT_AUTOHIDE);
if (m_bTaskBarAutoHide && !m_bTaskBarHidden)
{
rc.left = 0;
rc.right = GetSystemMetrics(SM_CXSCREEN);
rc.bottom = GetSystemMetrics(SM_CYSCREEN);
rc.top = rc.bottom - TASKBAR_HEIGHT_AUTOHIDE;
SlideWindow(m_hwndTaskBar, rc, FALSE);
if (!m_bTaskBarAbortHide)
{
m_bTaskBarHidden = TRUE;
ShowWindow(m_hwndTray, SW_HIDE);
}
}
m_bTaskBarAbortHide = FALSE;
}
void CTaskBar::SaveAutoHide(BOOL bAutoHide)
{
LONG lRet;
HKEY hkey;
DWORD dw;
lRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE, c_szShellAutoHide,
0, KEY_ALL_ACCESS, &hkey);
if(lRet != ERROR_SUCCESS) {
lRet = RegCreateKeyEx(HKEY_LOCAL_MACHINE, c_szShellAutoHide,
0, NULL, 0, KEY_ALL_ACCESS,
NULL, &hkey, &dw);
}
if (lRet == ERROR_SUCCESS) {
RegSetValueEx(hkey, TEXT(""), 0, REG_DWORD, (LPBYTE)&bAutoHide, sizeof(DWORD));
RegCloseKey(hkey);
}
}
BOOL CTaskBar::GetAutoHide(BOOL *pbAutoHide)
{
HKEY hkey;
LONG l;
DWORD dw = sizeof(DWORD);
DWORD dwType;
// Open up the registry and mark this change
if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, c_szShellAutoHide, 0,0,&hkey)) {
l = RegQueryValueEx(hkey, TEXT(""), 0, &dwType,
(LPBYTE) pbAutoHide, &dw);
RegCloseKey(hkey);
return TRUE;
}
return FALSE;
}
void CTaskBar::Cleanup()
{
SHFILEINFO sfi;
HIMAGELIST himl;
TaskMan_Destroy();
KillTimer(m_hwndTaskBar, IDT_ADMIN);
KillTimer(m_hwndTaskBar, IDT_AUTOHIDE);
KillTimer(m_hwndTaskBar, IDT_AUTOUNHIDE);
if (m_hwndRunDlg) {
DestroyWindow(m_hwndRunDlg);
}
if (Desktop_GetWindow()) {
DestroyWindow(Desktop_GetWindow());
}
delete m_plistTaskBar;
delete m_plistBubbles;
if (m_hiconDefault) {
DestroyIcon(m_hiconDefault);
}
if (g_hbrMonoDither) {
DeleteObject(g_hbrMonoDither);
g_hbrMonoDither = NULL;
}
himl = (HIMAGELIST)SHGetFileInfo(TEXT(""), 0, &sfi, sizeof(SHFILEINFO),
SHGFI_SYSICONINDEX | SHGFI_LARGEICON);
ImageList_Destroy(himl);
himl = (HIMAGELIST)SHGetFileInfo(TEXT(""), 0, &sfi, sizeof(SHFILEINFO),
SHGFI_SYSICONINDEX | SHGFI_SMALLICON);
ImageList_Destroy(himl);
#ifdef TASKBAR_TABHOOK
if (g_hdllAltTabHook)
FreeLibrary(g_hdllAltTabHook);
g_hdllAltTabHook = NULL;
g_pfnAltTabHook = NULL;
#endif
}
BOOL CTaskBar::Register(HINSTANCE hInstance)
{
。。。。。
return fOk;
}
HWND CTaskBar::Create(HWND hwndParent, LPTBITEMINFO lptbii, UINT nItems)
{
。。。。。。
return TRUE;
}
BOOL CTaskBar::Destroy(HWND hwndTB)
{
// BUGBUG - free up used resources
DestroyWindow(hwndTB);
return TRUE;
}