Example #1
0
/*------------------------------------------------
  CLOCKM_REFRESHTASKBAR message
--------------------------------------------------*/
void OnRefreshTaskbar(HWND hwnd)
{
	g_bVisualStyle = IsXPVisualStyle();
	
#if TC_ENABLE_STARTBUTTON
	ResetStartButton(hwnd); // startbtn.c
#endif
	InitTaskbar(hwnd);      // taskbar.c
#if TC_ENABLE_TASKSWITCH
	InitTaskSwitch(hwnd);   // taskswitch.c
#endif
	
	RefreshTaskbar(hwnd); // taskbar.c
}
Example #2
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
}