예제 #1
0
void CCtrlMessageBarDblSubclassWnd::UnSubclassWindow(HWND hWnd)
{
  if (hWnd == NULL)
    return;
  if (IsSubclassed(hWnd))
    SetWindowLong(hWnd, GWL_WNDPROC, (LONG)AfxGetAfxWndProc());
}
예제 #2
0
/*--------------------------------------------------
  Subclassify "Desktop User Pane" window of XP Start Menu
----------------------------------------------------*/
void SubclassUserPaneXP(void)
{
	if(!m_bSubclass) return;
	
	m_hwndDV2ContHost = FindWindow("DV2ControlHost", NULL);
	if(!m_hwndDV2ContHost) return;
	m_hwndUserPaneXP = FindWindowEx(m_hwndDV2ContHost, NULL,
		"Desktop User Pane", NULL);
	if(!m_hwndUserPaneXP) return;
	
	if(IsSubclassed(m_hwndUserPaneXP)) return;
	
	m_bUserPaneXPSubclassed = SetWindowSubclass(m_hwndUserPaneXP,
			SubclassProcUserPaneXP, 0, 0);
}
예제 #3
0
/*--------------------------------------------------
  initialize
----------------------------------------------------*/
void InitTrayNotify(HWND hwndClock)
{
	HWND hwnd;
	
	EndTrayNotify();
	
	if(GetMyRegLong(NULL, "NoClock", FALSE)) return;
	
	if(GetMyRegLong(NULL, "FillTray", FALSE) == FALSE) return;
	
	if(GetMyRegLong(NULL, "UseBackColor", TRUE) == FALSE) return;
	
	m_hwndClock = hwndClock;
	m_hwndTrayNotify = GetParent(hwndClock);  // TrayNotifyWnd
	
	if(IsSubclassed(m_hwndTrayNotify)) return;
	
	/* ---------- search toolbar ----------- */
	
	m_hwndToolbar = NULL;
	hwnd = FindWindowEx(m_hwndTrayNotify, NULL, "ToolbarWindow32", NULL);
	if(!hwnd)
	{
		hwnd = FindWindowEx(m_hwndTrayNotify, NULL, "SysPager", NULL);
		if(hwnd)
			hwnd = FindWindowEx(hwnd, NULL, "ToolbarWindow32", NULL);
	}
	m_hwndToolbar = hwnd;
	
	/* ---------- subclassify ------------ */
	
	m_oldClassStyle = GetClassLong(m_hwndTrayNotify, GCL_STYLE);
	SetClassLong(m_hwndTrayNotify, GCL_STYLE,
		m_oldClassStyle|CS_HREDRAW|CS_VREDRAW);
	
	SetWindowSubclass(m_hwndTrayNotify, SubclassProcTrayNotify, 0, 0);
	
	m_oldStyle = GetWindowLong(m_hwndTrayNotify, GWL_STYLE);
	SetWindowLong(m_hwndTrayNotify, GWL_STYLE,
		m_oldStyle & ~(WS_CLIPCHILDREN|WS_CLIPSIBLINGS));
	
	InvalidateRect(m_hwndTrayNotify, NULL, TRUE);
	
	if(m_hwndToolbar)
	{
		SendMessage(GetParent(m_hwndToolbar), WM_SYSCOLORCHANGE, 0, 0);
	}
}
예제 #4
0
BOOL CCtrlMessageBarDblSubclassWnd::SubclassWindow(HWND hWnd, CCtrlMessageBar* pBar/*=NULL*/)
{
  if (hWnd == NULL)
    return FALSE;
  CWnd* pWnd = CWnd::FromHandlePermanent(hWnd); // if not subclassed once, let us subclass.
  if (pWnd == NULL)
  {
    _CTempWndSubclass *pNewWnd = new _CTempWndSubclass;
    ASSERT(pNewWnd != NULL);
    VERIFY(pNewWnd->SubclassWindow(hWnd));
    ASSERT(CWnd::FromHandlePermanent(hWnd) != NULL);
  }
  if (IsSubclassed(hWnd)) // we've already subclassed it
    return TRUE;
  // attach the bar to the window, using properties
  SetProp(hWnd, szInstancePropertyName, (HANDLE)pBar);
#ifdef _DEBUG
  WNDPROC oldWndProc = (WNDPROC)
#endif // _DEBUG
      ::SetWindowLong(hWnd, GWL_WNDPROC, (DWORD)OurWndProc);
  ASSERT(oldWndProc == AfxGetAfxWndProc());
  ASSERT(oldWndProc != OurWndProc);
  return TRUE;
}
예제 #5
0
/*------------------------------------------------
  initialize the clock
--------------------------------------------------*/
void InitClock(HWND hwnd)
{
	RECT rc;
	
	if(g_bInitClock) return;
	g_bInitClock = TRUE;
	
	g_hInst = GetModuleHandle(DLLFILENAME);
	
	g_winver = CheckWinVersion();       // common/utl.c
	g_bVisualStyle = IsXPVisualStyle(); // common/utl.c
	
#if 0
	if(!(g_winver&WIN10RS1))
	{
		// check subclassification
		if(IsSubclassed(hwnd))
		{
			SendMessage(g_hwndTClockMain, TCM_CLOCKERROR, 0, 6);
			return;
		}
	}
#endif
	
	GetModuleFileName(g_hInst, g_mydir, MAX_PATH);
	del_title(g_mydir);
	
	strcpy(g_inifile, g_mydir);
	add_title(g_inifile, "tclock.ini");
	g_bIniSetting = TRUE;
/*  g_bIniSetting = FALSE;
	if(IsFile(g_inifile)) g_bIniSetting = TRUE; */
	
	// Save the original window size
	GetWindowRect(hwnd, &rc);
	g_OrigClockWidth = rc.right - rc.left;
	g_OrigClockHeight = rc.bottom - rc.top;
	// Save taskbar direction
	g_bVertTaskbar = IsVertTaskbar(GetParent(GetParent(hwnd)));
	g_bTaskbarPosChanging = FALSE;
	
	// tell tclock.exe clock's HWND
	PostMessage(g_hwndTClockMain, TCM_HWNDCLOCK, 0, (LPARAM)hwnd);
	
	// read settings
	LoadSetting(hwnd);
	
	InitTooltip(hwnd); // tooltip.c
	InitUserStr();     // userstr.c
	
	// subclassfy the clock window !!
	if(g_winver&WIN10RS1)
	{
		SetWindowSubclass(GetParent(hwnd), SubclassTrayProc,
				SUBCLASSTRAY_ID, (DWORD_PTR)hwnd);
	}
	SetWindowSubclass(hwnd, SubclassProc, SUBCLASS_ID, 0);
	
	// don't accept double clicks
	SetClassLong(hwnd, GCL_STYLE,
		GetClassLong(hwnd, GCL_STYLE) & ~CS_DBLCLKS);
	
#if TC_ENABLE_STARTBUTTON
	InitStartButton(hwnd); // startbtn.c
#endif
#if TC_ENABLE_STARTMENU
	InitStartMenu(hwnd);   // startmenu.c
#endif
#if TC_ENABLE_TASKBAR
	InitTaskbar(hwnd);     // taskbar.c
#endif
#if TC_ENABLE_TASKSWITCH
	InitTaskSwitch(hwnd);  // taskswitch.c
#endif
#if TC_ENABLE_TRAYNOTIFY
	InitTrayNotify(hwnd);  // traynotify.c
#endif
#if TC_ENABLE_VOLUME
	InitMixer();           // mixer.c
#endif
#if TC_ENABLE_SYSINFO
	InitSysInfo(hwnd);     // sysinfo.c
#endif
	
#if TC_ENABLE_TASKBAR
	RefreshTaskbar(hwnd);  // taskbar.c
#else
	PostMessage(GetParent(GetParent(hwnd)), WM_SIZE, SIZE_RESTORED, 0);
	InvalidateRect(GetParent(GetParent(hwnd)), NULL, TRUE);
#endif
	
	SetTimer(hwnd, IDTIMER_MAIN, 1000, NULL);
	
#if TC_ENABLE_DESKTOPICON
	SetDesktopIcons();     // desktop.c
#endif
}