コード例 #1
0
ファイル: pageformat.c プロジェクト: k-takata/TClockLight
/*------------------------------------------------
  Apply changes
--------------------------------------------------*/
void OnApply(HWND hDlg)
{
	char s[BUFSIZE_FORMAT];
	int i;
	
	if(!m_bChanged) return;
	m_bChanged = FALSE;
	
	SetMyRegLong("", "Locale",
		CBGetItemData(hDlg, IDC_LOCALE, CBGetCurSel(hDlg, IDC_LOCALE)));
	
	for(i = IDC_YEAR4; i <= IDC_CUSTOM; i++)
	{
		SetMyRegLong("", ENTRY(i), IsDlgButtonChecked(hDlg, i));
	}
	
	GetDlgItemText(hDlg, IDC_FORMAT, s, BUFSIZE_FORMAT);
	SetMyRegStr("", "Format", s);
	
	if(IsDlgButtonChecked(hDlg, IDC_CUSTOM))
	{
		strcpy(m_CustomFormat, s);
		SetMyRegStr("", "CustomFormat", m_CustomFormat);
	}
	
#if TC_ENABLE_SYSINFO
	SetMyRegLong(NULL, "IntervalSysInfo",
		UpDown_GetPos(hDlg,IDC_SYSIISPIN));
#endif
}
コード例 #2
0
ファイル: UTL.C プロジェクト: Nikers/T-Clock
LONG GetMyRegLongEx(char* section, char* entry, LONG defval)
{
	char key[80];
	HKEY hkey;
	DWORD regtype;
	DWORD size;
	BOOL b;
	LONG r;
	
	if(g_bIniSetting) key[0] = 0;
	else strcpy(key, mykey);
	
	if(section && *section)
	{
		if(!g_bIniSetting) strcat(key, "\\");
		strcat(key, section);
	}
	else
	{
		if(g_bIniSetting) strcpy(key, "Main");
	}
	
	if(g_bIniSetting)
	{
		r = GetPrivateProfileInt(key, entry, defval, g_inifile);
		if(r = defval)
			SetMyRegLong(section, entry, defval);
	}
	else
	{
		b = FALSE;
		if(RegOpenKey(HKEY_CURRENT_USER, key, &hkey) == 0)
		{
			size = 4;
			if(RegQueryValueEx(hkey, entry, 0, &regtype,
				(LPBYTE)&r, &size) == 0)
			{
				if(size == 4) b = TRUE;
			}
			RegCloseKey(hkey);
		}
		if(b == FALSE) 
		{
			r = defval;
			SetMyRegLong(section, entry, defval);
		}
	}
	return r;
}
コード例 #3
0
ファイル: pageautoexec.c プロジェクト: h16o2u9u/rtoss
/*------------------------------------------------
   apply - save settings
--------------------------------------------------*/
void OnApply(HWND hDlg)
{
	int i, count, n_autoexec;
	PAUTOEXECSTRUCT pAS;

	n_autoexec = 0;

	if(curAutoExec < 0)
	{
		char name[40];
		GetDlgItemText(hDlg, IDC_COMBOAUTOEXEC, name, 40);
		if(name[0] && IsDlgButtonChecked(hDlg, IDC_AUTOEXEC))
		{
			pAS = malloc(sizeof(AUTOEXECSTRUCT));
			if(pAS)
			{
				int index;
				GetAutoExecFromDlg(hDlg, pAS);
				index = CBAddString(hDlg, IDC_COMBOAUTOEXEC, (LPARAM)pAS->name);
				CBSetItemData(hDlg, IDC_COMBOAUTOEXEC, index, (LPARAM)pAS);
				curAutoExec = index;
				CBSetCurSel(hDlg, IDC_COMBOAUTOEXEC, index);
				EnableDlgItem(hDlg, IDC_DELAUTOEXEC, TRUE);
			}
		}
	}
	else
	{
		pAS = (PAUTOEXECSTRUCT)CBGetItemData(hDlg, IDC_COMBOAUTOEXEC, curAutoExec);
		if(pAS)
			GetAutoExecFromDlg(hDlg, pAS);
	}

	count = CBGetCount(hDlg, IDC_COMBOAUTOEXEC);
	for(i = 0; i < count; i++)
	{
		PAUTOEXECSTRUCT pAS;
		pAS = (PAUTOEXECSTRUCT)CBGetItemData(hDlg, IDC_COMBOAUTOEXEC, i);
		if(pAS)
		{
			SaveAutoExecToReg(pAS, n_autoexec);
			n_autoexec++;
		}
	}
	for(i = n_autoexec; ; i++)
	{
		char subkey[20];
		wsprintf(subkey, "AutoExec%d", i + 1);
		if(GetMyRegLong(subkey, "Hour", -1) >= 0)
			DelMyRegKey(subkey);
		else break;
	}

	SetMyRegLong("", "AutoExecNum", n_autoexec);

	InitAlarm(); // alarm.c
}
コード例 #4
0
ファイル: pagemouse.c プロジェクト: k-takata/TClockLight
/*------------------------------------------------
   apply - save settings
--------------------------------------------------*/
void OnApply(HWND hDlg)
{
	if(!m_bChanged) return;
	m_bChanged = FALSE;
	
	OnNameDropDown(hDlg);
	
	GetMouseCommandFromDlg(hDlg, get_listitem(m_pMouseCommand, m_nCurrent));
	
	SaveMouseFunc(m_pMouseCommand); // common/mousestruct.c
	
	SetMyRegLong(m_section, "LeftMousePassThrough",
		IsDlgButtonChecked(hDlg, IDC_LMOUSEPASSTHRU));
	
	SetMyRegLong(m_section, "RightClickMenu",
		IsDlgButtonChecked(hDlg, IDC_RCLICKMENU));
	DelMyReg(NULL, "RightClickMenu");
}
コード例 #5
0
ファイル: pagemisc.c プロジェクト: meizhitu/TClockLight
/*------------------------------------------------
  apply
--------------------------------------------------*/
void OnApply(HWND hDlg)
{
	char s[MAX_PATH];
	
	SetMyRegLong(NULL, "NoClock",
		IsDlgButtonChecked(hDlg, IDC_NOCLOCK));
	
	SetMyRegLong(NULL, "MCIWave",
		IsDlgButtonChecked(hDlg, IDC_MCIWAVE));
	
	SetMyRegLong(NULL, "DelayStart",
		GetDlgItemInt(hDlg, IDC_DELAYSTART, NULL, FALSE));
	
	SetMyRegLong(NULL, "TaskbarRestart",
		IsDlgButtonChecked(hDlg, IDC_TASKBARRESTART));
	
#if TC_ENABLE_DESKTOPICON
	SetMyRegLong(NULL, "DeskTopIcon",
		IsDlgButtonChecked(hDlg, IDC_DESKTOPICON));
	
	SetMyRegLong(NULL, "TransDeskTopIconBK",
		IsDlgButtonChecked(hDlg, IDC_TRANSDESKTOPICONBK));
#endif
	
	GetDlgItemText(hDlg, IDC_HELPURL, s, MAX_PATH);
	SetMyRegStr(NULL, "HelpURL", s);
	
#if TC_ENABLE_DESKTOPICON
	SetDesktopIcons();
#endif
}
コード例 #6
0
ファイル: dialog.c プロジェクト: meizhitu/TClockLight
/*-------------------------------------------
  "OK" button
---------------------------------------------*/
void OnOK(HWND hDlg)
{
	int i;
	
	SetMyRegLong(m_section, "Disp",
		IsDlgButtonChecked(hDlg, IDC_SHOWTIME));
	for(i = 0; i < 3; i++)
	{
		if(IsDlgButtonChecked(hDlg, IDC_SHOWWHOLE+i))
		{
			SetMyRegLong(m_section, "DispType", i);
			break;
		}
	}
	SetMyRegLong(m_section, "UserStr", 
		GetDlgItemInt(hDlg, IDC_SHOWUSTRNUM, NULL, FALSE));
	
	if(IsPlayerPlaying())
		InitPlayer(g_hwndPlayer);
	else
		PostMessage(g_hwndPlayer, WM_CLOSE, 0, 0);
	DestroyWindow(hDlg);
	g_hDlg = FALSE;
}
コード例 #7
0
ファイル: main.c プロジェクト: k-takata/TClockLight
/*-------------------------------------------
  dialog procedure
---------------------------------------------*/
INT_PTR CALLBACK DlgProc(HWND hDlg, UINT message,
	WPARAM wParam, LPARAM lParam)

{
	switch(message)
	{
		case WM_INITDIALOG:
			OnInitDialog(hDlg);
			return TRUE;
		case WM_COMMAND:
		{
			WORD id; // , code;
			id = LOWORD(wParam); // code = HIWORD(wParam);
			switch(id)
			{
				case IDC_APPLY:
					OnApply(hDlg);
					break;
				case IDC_MYHELP:
					OnHelp(hDlg);
					break;
				case IDOK:
					OnOK(hDlg);
				case IDCANCEL:
					if(g_hfontDialog)
						DeleteObject(g_hfontDialog);
					SetMyRegLong(NULL, "LastTreeItem", m_lastTreeItem);
					EndDialog(hDlg, id);
					break;
			}
			return TRUE;
		}
		case WM_NOTIFY:
		{
			NM_TREEVIEW* pNMTV = (NM_TREEVIEW *)lParam;
			if(pNMTV->hdr.code == TVN_SELCHANGED)
			{
				OnTVChanged(hDlg, (int)pNMTV->itemNew.lParam);
				return TRUE;
			}
			break;
		}
		case PSM_CHANGED:
			EnableDlgItem(hDlg, IDC_APPLY, TRUE);
			return TRUE;
	}
	return FALSE;
}
コード例 #8
0
ファイル: pageanalog.c プロジェクト: k-takata/TClockLight
/*------------------------------------------------
  Apply changes
--------------------------------------------------*/
void OnApply(HWND hDlg)
{
	int i;
	char s[MAX_PATH];

	if(!m_bChanged) return;
	m_bChanged = FALSE;
	
	SetMyRegLong(m_section, "UseAnalogClock",
		IsDlgButtonChecked(hDlg, IDC_ANALOGCLOCK));

	SetMyRegLong(m_section, "HourHandColor",
		CBGetItemData(hDlg, IDC_COLHOUR, CBGetCurSel(hDlg, IDC_COLHOUR)));
	SetMyRegLong(m_section, "MinHandColor",
		CBGetItemData(hDlg, IDC_COLMIN, CBGetCurSel(hDlg, IDC_COLMIN)));

	SetMyRegLong(m_section, "HourHandBold",
		IsDlgButtonChecked(hDlg, IDC_HOURHANDBOLD));
	SetMyRegLong(m_section, "MinHandBold",
		IsDlgButtonChecked(hDlg, IDC_MINHANDBOLD));

	if(IsDlgButtonChecked(hDlg, IDC_ANALOGPOSLEFT)) i = 1;
	else if(IsDlgButtonChecked(hDlg, IDC_ANALOGPOSRIGHT)) i = 2;
	else i = 0;
	SetMyRegLong(m_section, "AnalogClockPos", i);

	SetMyRegLong(m_section, "HorizontalPos",
		UpDown_GetPos(hDlg,IDC_ANALOGHPOSSPIN));
	SetMyRegLong(m_section, "VerticalPos",
		UpDown_GetPos(hDlg,IDC_ANALOGVPOSSPIN));

	SetMyRegLong(m_section, "Size",
		UpDown_GetPos(hDlg,IDC_ANALOGSIZESPIN));

	GetDlgItemText(hDlg, IDC_ANALOGBMP, s, MAX_PATH);
	SetMyRegStr(m_section, "Bitmap", s);
}
コード例 #9
0
ファイル: dialog.c プロジェクト: k-takata/TClockLight
/*-------------------------------------------
  "Start" button
---------------------------------------------*/
void OnOK(HWND hDlg)
{
	PTIMERSTRUCT pitem;
	char section[20];
	int i, nOldTimer;
	
	/* save settings */
	GetTimerFromDlg(hDlg, get_listitem(m_pTimer, m_nCurrent));
	
	nOldTimer = GetMyRegLong(NULL, "TimerNum", 0);
	
	pitem = m_pTimer;
	for(i = 0; pitem; i++)
	{
		wsprintf(section, "Timer%d", i + 1);
		SetMyRegStr(section, "Name", pitem->name);
		SetMyRegLong(section, "Minute", pitem->minute);
		SetMyRegLong(section, "Second", pitem->second);
		SetMyRegStr(section, "File", pitem->fname);
		SetMyRegLong(section, "Repeat", pitem->bRepeat);
		SetMyRegLong(section, "Blink", pitem->bBlink);
		SetMyRegLong(section, "Disp", pitem->bDisp);
		SetMyRegLong(section, "DispType", pitem->nDispType);
		SetMyRegLong(section, "UserStr", pitem->nUserStr);
		
		pitem = pitem->next;
	}
	
	SetMyRegLong(NULL, "TimerNum", i);
	
	for(; i < nOldTimer; i++)
	{
		wsprintf(section, "Timer%d", i + 1);
		DelMyRegKey(section);
	}
	
	/* start a timer */
	TimerStart(get_listitem(m_pTimer, m_nCurrent));
	
	DestroyWindow(hDlg);
}
コード例 #10
0
ファイル: pageautoexec.c プロジェクト: h16o2u9u/rtoss
/*------------------------------------------------
  save settings of an alarm
--------------------------------------------------*/
void SaveAutoExecToReg(PAUTOEXECSTRUCT pAS, int num)
{
	char subkey[20];

	wsprintf(subkey, "AutoExec%d", num + 1);
	SetMyRegStr(subkey, "Name", pAS->name);
	SetMyRegLong(subkey, "AutoExec", pAS->bAutoExec);
	SetMyRegLong(subkey, "Hour", pAS->hour);
	SetMyRegLong(subkey, "Minute1", pAS->minute1);
	SetMyRegLong(subkey, "Minute2", pAS->minute2);
	SetMyRegStr(subkey, "File", pAS->fname);
	SetMyRegLong(subkey, "Days", pAS->days);
	SetMyRegLong(subkey, "OnBoot", pAS->bOnBoot);
}
コード例 #11
0
ファイル: sntp.c プロジェクト: h16o2u9u/rtoss
/*---------------------------------------------------
    command to start syncronizing
---------------------------------------------------*/
void StartSyncTime(HWND hwndParent, char* pServer, int nto)
{
	HWND hwnd;
	SYSTEMTIME st;
	char section[] = "SNTP";
	char server[80], s[80];

	if(g_socket != -1 || g_hGetHost != NULL) return;

	if(pServer == NULL || *pServer == 0)
	{
		GetMyRegStr(section, "Server", server, 80, "");
		pServer = server;
	}
	if(nto == 0)
		nto = GetMyRegLong(section, "Timeout", 1000);

	if(*pServer == 0) return;
	hwnd = GetDlgItem(hwndParent, 1);
	if(!hwnd) return;

	nMinuteDif = 0;
	GetMyRegStr(section, "Dif", s, 80, "");
	if(s[0])
	{
		int h, m;
		time2int(&h, &m, s);
		nMinuteDif = h * 60 + m;
	}

	GetLocalTime(&st);
	nLastDay = st.wDay;
	SetMyRegLong(section, "LastDay", nLastDay);
	dwTickCount = GetTickCount();
	bFirst = FALSE;

	nTimeout = nto;

	SNTPStart(hwnd, pServer);
}
コード例 #12
0
ファイル: sntp.c プロジェクト: h16o2u9u/rtoss
/*---------------------------------------------------
	set system time to received data
---------------------------------------------------*/
void SynchronizeSystemTime(DWORD seconds, DWORD fractions)
{
	FILETIME ft, ftold;
	SYSTEMTIME st, st_dif, lt;
	char s[1024];
	DWORD sr_time;
	DWORDLONG dif;
	BOOL b;

	// timeout ?
	sr_time = GetTickCount() - dwTickCountOnSend;
	if(sr_time >= (DWORD)nTimeout)
	{
		wsprintf(s, "timeout (%04d)", sr_time);
		Log(s); return;
	}

	// current time
	GetSystemTimeAsFileTime(&ftold);

	// NTP data -> FILETIME
	*(DWORDLONG*)&ft =
		// seconds from 1900/01/01 �� 100 nano-seconds from 1601/01/01
		M32x32to64(seconds, 10000000) + 94354848000000000i64;

	// difference
	if(nMinuteDif > 0)
		*(DWORDLONG*)&ft += M32x32to64(nMinuteDif * 60, 10000000);
	else if(nMinuteDif < 0)
		*(DWORDLONG*)&ft -= M32x32to64(-nMinuteDif * 60, 10000000);

	// set system time
	b = FileTimeToSystemTime(&ft, &st);
	if(b)
	{
		/* fractions: (2 ** 32 / 1000) */
		st.wMilliseconds = (WORD)(fractions / 4294967);
		b = SetSystemTime(&st);
	}
	if(!b)
	{
		Log("failed to set time"); return;
	}

	GetLocalTime(&lt);
	nLastDay = lt.wDay;
	SetMyRegLong("SNTP", "LastDay", nLastDay);

	SystemTimeToFileTime(&st, &ft);
	// delayed or advanced
	b = (*(DWORDLONG*)&ft > *(DWORDLONG*)&ftold);
	// get difference
	if(b) dif = *(DWORDLONG*)&ft - *(DWORDLONG*)&ftold;
	else  dif = *(DWORDLONG*)&ftold - *(DWORDLONG*)&ft;
	FileTimeToSystemTime((FILETIME*)&dif, &st_dif);

	// save log
	strcpy(s, "synchronized ");
	if(st_dif.wYear == 1601 && st_dif.wMonth == 1 &&
		st_dif.wDay == 1 && st_dif.wHour == 0)
	{
		strcat(s, b?"+":"-");
		wsprintf(s + strlen(s), "%02d:%02d.%03d ",
			st_dif.wMinute, st_dif.wSecond, st_dif.wMilliseconds);
	}
	wsprintf(s + strlen(s), "(%04d)", sr_time);
	Log(s);

	GetMyRegStr("SNTP", "Sound", s, 1024, "");
	PlayFile(g_hwndMain, s, 0);
}
コード例 #13
0
ファイル: pagemisc.c プロジェクト: h16o2u9u/rtoss
/*------------------------------------------------
 更新
--------------------------------------------------*/
void OnApply(HWND hDlg)
{
	char s[1024];
	DWORD dw;

	SetMyRegLong("", "NoClock", IsDlgButtonChecked(hDlg, IDC_NOCLOCK));

	SetMyRegLong("", "MCIWave", IsDlgButtonChecked(hDlg, IDC_MCIWAVE));

	SetMyRegLong("", "DelayStart",
		SendDlgItemMessage(hDlg, IDC_SPINDELAYSTART, UDM_GETPOS, 0, 0));
	SetMyRegLong("", "DelayNet",
		SendDlgItemMessage(hDlg, IDC_SPINDELAYNET, UDM_GETPOS, 0, 0));

	SetMyRegLong("", "DoNetRestart", IsDlgButtonChecked(hDlg, IDC_CHECKNETWORK));
	SetMyRegLong("", "NetRestartInterval",
		SendDlgItemMessage(hDlg, IDC_SPINCHECKNETINTERVAL, UDM_GETPOS, 0, 0));

	SetMyRegLong("", "Deskcal", IsDlgButtonChecked(hDlg, IDC_DESKCAL));

	GetDlgItemText(hDlg, IDC_COMDESKCAL, s, 1024);
	SetMyRegStr("", "DeskcalCommand", s);

	SetMyRegLong("", "DeskcalOnlyDate",
		IsDlgButtonChecked(hDlg, IDC_ONLYDATECHANGED));

	SetMyRegLong("", "DeskcalResumeSuspend",
		IsDlgButtonChecked(hDlg, IDC_RESUMESUSPEND));

	SetMyRegLong("", "DeskcalTonikaku",
		IsDlgButtonChecked(hDlg, IDC_TONIKAKU));
	SetMyRegLong("", "WatchWallpaper",
		IsDlgButtonChecked(hDlg, IDC_WATCHWALL));

	SetMyRegLong("", "WatchTaskbarWindow", IsDlgButtonChecked(hDlg, IDC_TASKWNDCTRL));

	dw = GetDlgItemInt(hDlg, IDC_CONFMAX, NULL, FALSE);
	if(dw > 30) dw = 30;
	if(dw < 1  ) dw = 1;
	SetDlgItemInt(hDlg, IDC_CONFMAX, dw, FALSE);

	SetMyRegLong("", "ConfigMax", dw);

	InitWatchWallpaper(); // deskcal.c
}
コード例 #14
0
ファイル: pagecolor.c プロジェクト: k-takata/TClockLight
/*------------------------------------------------
  Apply
--------------------------------------------------*/
void OnApply(HWND hDlg)
{
	char s[80];
#if TC_ENABLE_CLOCKDECORATION
	int i;
#endif
	
	// settings of "background" and "text"
	
	if(!m_bChanged) return;
	m_bChanged = FALSE;
	
	SetMyRegLong(NULL, "UseBackColor",
		IsDlgButtonChecked(hDlg, IDC_CHKCOLOR));
	SetMyRegLong(NULL, "BackColor",
		CBGetItemData(hDlg, IDC_COLBACK, CBGetCurSel(hDlg, IDC_COLBACK)));
	
	SetMyRegLong(NULL, "UseBackColor2",
		IsDlgButtonChecked(hDlg, IDC_CHKCOLOR2));
	SetMyRegLong(NULL, "BackColor2",
		CBGetItemData(hDlg, IDC_COLBACK2, CBGetCurSel(hDlg, IDC_COLBACK2)));
	
	SetMyRegLong(NULL, "GradDir",
		IsDlgButtonChecked(hDlg, IDC_GRAD1) ? 0 : 1);
	
	SetMyRegLong(NULL, "FillTray",
		IsDlgButtonChecked(hDlg, IDC_FILLTRAY));
	
	SetMyRegLong(NULL, "ForeColor",
		CBGetItemData(hDlg, IDC_COLFORE, CBGetCurSel(hDlg, IDC_COLFORE)));
	
#if TC_ENABLE_CLOCKDECORATION
	// settings of decoration
	if(IsDlgButtonChecked(hDlg, IDC_DECOSHADOW)) i = 1;
	else if(IsDlgButtonChecked(hDlg, IDC_DECOBORDER)) i = 2;
	else i = 0;
	SetMyRegLong(NULL, "ClockDecoration", i);
	SetMyRegLong(NULL, "ShadowColor",
		CBGetItemData(hDlg, IDC_COLSHADOW, CBGetCurSel(hDlg, IDC_COLSHADOW)));
	SetMyRegLong(NULL, "ShadowRange",
		UpDown_GetPos(hDlg,IDC_SHADOWRANGESPIN));
#endif
	
	// settings of "font" and "font size"
	
	CBGetLBText(hDlg, IDC_FONT, CBGetCurSel(hDlg, IDC_FONT), s);
	SetMyRegStr(NULL, "Font", s);
	
	GetDlgItemText(hDlg, IDC_FONTSIZE, s, 10);
	if(s[0]) SetMyRegStr(NULL, "FontSize", s);
	else SetMyRegStr(NULL, "FontSize", "9");
	
	SetMyRegLong(NULL, "Bold", IsDlgButtonChecked(hDlg, IDC_BOLD));
	SetMyRegLong(NULL, "Italic", IsDlgButtonChecked(hDlg, IDC_ITALIC));
}
コード例 #15
0
ファイル: PageHotKey.c プロジェクト: Nikers/T-Clock
 //================================================================================================
//-----------------------------------------------+++--> Save the New HotKey Configuration Settings:
void OnApply(HWND hDlg) { //----------------------------------------------------------------+++-->
	char subkey[TNY_BUFF] = {0};
	int i;

  if(tchk[0].bValid) { // Add/Edit Active Timers
	  RegisterHotKey(g_hWnd, HOT_TIMER, tchk[0].fsMod, tchk[0].vk);
  }else{
	  tchk[0].vk = 0;
	  tchk[0].fsMod = 0;
	  strcpy(tchk[0].szText, "None");
	  UnregisterHotKey(g_hWnd, HOT_TIMER);
  }

  if(tchk[1].bValid) { // Display StopWatch
	  RegisterHotKey(g_hWnd, HOT_STOPW, tchk[1].fsMod, tchk[1].vk);
  }else{
	  tchk[1].vk = 0;
	  tchk[1].fsMod = 0;
	  strcpy(tchk[1].szText, "None");
	  UnregisterHotKey(g_hWnd, HOT_STOPW);
  }

  if(tchk[2].bValid) { // Display Watched (and active) Timers
	  RegisterHotKey(g_hWnd, HOT_WATCH, tchk[2].fsMod, tchk[2].vk);
  }else{
	  tchk[2].vk = 0;
	  tchk[2].fsMod = 0;
	  strcpy(tchk[2].szText, "None");
	  UnregisterHotKey(g_hWnd, HOT_WATCH);
  }

  if(tchk[3].bValid) { // Display Watched (and active) Timers
	  RegisterHotKey(g_hWnd, HOT_PROPR, tchk[3].fsMod, tchk[3].vk);
  }else{
	  tchk[3].vk = 0;
	  tchk[3].fsMod = 0;
	  strcpy(tchk[3].szText, "None");
	  UnregisterHotKey(g_hWnd, HOT_PROPR);
  }

  if(tchk[4].bValid) { // Display Watched (and active) Timers
	  RegisterHotKey(g_hWnd, HOT_CALEN, tchk[4].fsMod, tchk[4].vk);
  }else{
	  tchk[4].vk = 0;
	  tchk[4].fsMod = 0;
	  strcpy(tchk[4].szText, "None");
	  UnregisterHotKey(g_hWnd, HOT_CALEN);
  }
  ///////////////////////////////////////////////////////////////////////////////////
  for(i = 0; i <= 4; i++) {
	  wsprintf(subkey, "%s\\HK%d", szHotKeySubKey, i);
	  SetMyRegLong(subkey, "bValid", tchk[i].bValid);
	  SetMyRegLong(subkey, "fsMod",  tchk[i].fsMod);
	  SetMyRegStr(subkey, "szText", tchk[i].szText);
	  SetMyRegLong(subkey, "vk",  tchk[i].vk);
  }
  //////////////////////////////////////////////////////////////////////////////////
  bFirstTime = FALSE; // DO NOT Let Property Sheet Manager Fire OnApply(...) Twice!
  EnableWindow(GetDlgItem(hDlg, IDCE_HK_ADD),  FALSE);
  EnableWindow(GetDlgItem(hDlg, IDCE_HK_STOP), FALSE);
  EnableWindow(GetDlgItem(hDlg, IDCE_HK_TIME), FALSE);
  EnableWindow(GetDlgItem(hDlg, IDCE_HK_PROP), FALSE);
  EnableWindow(GetDlgItem(hDlg, IDCE_HK_CALN), FALSE);
  EnableWindow(GetDlgItem(hDlg, IDCB_HK_ADD),  TRUE);
  EnableWindow(GetDlgItem(hDlg, IDCB_HK_STOP), TRUE);
  EnableWindow(GetDlgItem(hDlg, IDCB_HK_TIME), TRUE);
  EnableWindow(GetDlgItem(hDlg, IDCB_HK_PROP), TRUE);
  EnableWindow(GetDlgItem(hDlg, IDCB_HK_CALN), TRUE);
}
コード例 #16
0
ファイル: pagemouse.c プロジェクト: k-takata/TClockLight
/*------------------------------------------------
  initialize
--------------------------------------------------*/
void OnInit(HWND hDlg)
{
	PMOUSESTRUCT pitem;
	RECT rc;
	BOOL b;
	
	m_bInit = FALSE;
	
	if(GetMyRegLong(m_section, "ver031031", 0) == 0)
	{
		SetMyRegLong(m_section, "ver031031", 1);
		ImportOldMouseFunc(); // common/mousestruct.c
	}
	
	// common/mousestruct.c
	m_pMouseCommand = LoadMouseFunc();
	
	// common/tclang.c
	SetDialogLanguage(hDlg, "Mouse", g_hfontDialog);
	
	GetWindowRect(GetDlgItem(hDlg, IDC_MOUSEOPT), &rc);
	m_widthOpt = rc.right - rc.left;
	
	CBAddString(hDlg, IDC_MOUSEBUTTON,
		(LPARAM)MyString(IDS_LEFTBUTTON, "LButton"));
	CBAddString(hDlg, IDC_MOUSEBUTTON,
		(LPARAM)MyString(IDS_RIGHTBUTTONM, "RButton"));
	CBAddString(hDlg, IDC_MOUSEBUTTON,
		(LPARAM)MyString(IDS_MIDDLEBUTTONM, "MButton"));
	CBAddString(hDlg, IDC_MOUSEBUTTON,
		(LPARAM)MyString(IDS_XBUTTON1, "XButton1"));
	CBAddString(hDlg, IDC_MOUSEBUTTON,
		(LPARAM)MyString(IDS_XBUTTON2, "XButton2"));
#if TC_ENABLE_WHEEL
	CBAddString(hDlg, IDC_MOUSEBUTTON,
		(LPARAM)MyString(IDS_WHEELUP, "WheelUp"));
	CBAddString(hDlg, IDC_MOUSEBUTTON,
		(LPARAM)MyString(IDS_WHEELDOWN, "WheelDown"));
#endif
	
	InitFunction(hDlg, IDC_MOUSEFUNC);
	
	pitem = m_pMouseCommand;
	while(pitem)
	{
		CBAddString(hDlg, IDC_NAMECLICK, (LPARAM)pitem->name);
		pitem = pitem->next;
	}
	
	m_nCurrent = -1;
	CBSetCurSel(hDlg, IDC_NAMECLICK, 0);
	OnName(hDlg);
	
	CheckDlgButton(hDlg, IDC_LMOUSEPASSTHRU,
		GetMyRegLong(m_section, "LeftMousePassThrough",
			(g_winver&WIN10RS1) != 0));
	
	b = GetMyRegLong(NULL, "RightClickMenu", TRUE);
	b = GetMyRegLong(m_section, "RightClickMenu", b);
	CheckDlgButton(hDlg, IDC_RCLICKMENU, b);
	
	m_bInit = TRUE;
}