/*--------------------------------------------------- initialize WinSock and read settings ---------------------------------------------------*/ BOOL InitSNTP(HWND hwndMain) { WORD ver; WSADATA wsaData; char s[80]; m_socket = INVALID_SOCKET; m_hGetHost = NULL; // initialize WinSock ver = 0x0101; // MAKEWORD(1, 1); if(WSAStartup(ver, &wsaData) != 0) { Log(NULL, "failed to initialize"); return FALSE; } GetMyRegStr(m_section, "Server", m_servername, 80, ""); m_nTimeOut = GetMyRegLong(m_section, "Timeout", 1000); if(!(0 < m_nTimeOut && m_nTimeOut <= 30000)) m_nTimeOut = 1000; m_bSaveLog = GetMyRegLong(m_section, "SaveLog", TRUE); GetMyRegStr(m_section, "Sound", m_soundfile, MAX_PATH, ""); m_nMinuteDif = 0; GetMyRegStr(m_section, "Dif", s, 80, ""); if(s[0]) { int h, m; time2int(&h, &m, s); m_nMinuteDif = h * 60 + m; } return TRUE; }
/*------------------------------------------------ [OnContextMenu] AppN=TClockPlayerClass,PLAYERM_REQUESTMENU -------------------------------------------------*/ void SetOnContextMenu(void) { char entry[20], buf[100], cname[80], num[20]; BOOL b; int i; for(i = 0; ; i++) { wsprintf(entry, "App%d", i + 1); GetMyRegStr("OnContextMenu", entry, buf, 100, ""); b = FALSE; if(buf[0]) { parse(cname, buf, 0, 80); parse(num, buf, 1, 20); if(strcmp(cname, CLASS_TCLOCKPLAYER) == 0) { if(PLAYERM_REQUESTMENU == atoi(num)) break; else b = TRUE; } } else b = TRUE; if(b) { wsprintf(buf, "%s,%d", CLASS_TCLOCKPLAYER, PLAYERM_REQUESTMENU); SetMyRegStr("OnContextMenu", entry, buf); break; } } }
/*------------------------------------------------ initialize --------------------------------------------------*/ void OnInit(HWND hDlg) { char s[MAX_PATH]; // common/tclang.c SetDialogLanguage(hDlg, "Misc", g_hfontDialog); CheckDlgButton(hDlg, IDC_NOCLOCK, GetMyRegLong(NULL, "NoClock", FALSE)); CheckDlgButton(hDlg, IDC_MCIWAVE, GetMyRegLong(NULL, "MCIWave", FALSE)); SetDlgItemInt(hDlg, IDC_DELAYSTART, GetMyRegLong(NULL, "DelayStart", 0), FALSE); CheckDlgButton(hDlg, IDC_TASKBARRESTART, GetMyRegLong(NULL, "TaskbarRestart", FALSE)); #if TC_ENABLE_DESKTOPICON CheckDlgButton(hDlg, IDC_DESKTOPICON, GetMyRegLong(NULL, "DeskTopIcon", FALSE)); CheckDlgButton(hDlg, IDC_TRANSDESKTOPICONBK, GetMyRegLong(NULL, "TransDeskTopIconBK", FALSE)); #endif GetMyRegStr(NULL, "HelpURL", s, MAX_PATH, ""); SetDlgItemText(hDlg, IDC_HELPURL, s); m_bInit = TRUE; }
/*------------------------------------------------ initialize --------------------------------------------------*/ void InitAlarm(void) { ALARMSTRUCT item; PALARMSTRUCT pitem; int jihou; clear_list(m_pAlarm); m_pAlarm = NULL; jihou = 0; if(GetMyRegLong("", "Jihou", FALSE)) jihou = 1; // read settings m_pAlarm = LoadAlarm(); // common/alarmstruct.c // cuckoo clock if(jihou) { memset(&item, 0, sizeof(ALARMSTRUCT)); strcpy(item.name, "cuckoo"); strcpy(item.strHours, "*"); strcpy(item.strMinutes, "0"); strcpy(item.strWDays, "*"); SetAlarmTime(&item); // common/alarmstruct.c item.bEnable = TRUE; item.bHour12 = TRUE; GetMyRegStr("", "JihouFile", item.fname, MAX_PATH, ""); if(GetMyRegLong("", "JihouRepeat", FALSE)) item.bRepeatJihou = TRUE; if(GetMyRegLong("", "JihouBlink", FALSE)) { item.bBlink = TRUE; item.nBlinkSec = 60; } m_pAlarm = copy_listitem(m_pAlarm, &item, sizeof(item)); } m_bCheckEverySeconds = FALSE; pitem = m_pAlarm; while(pitem) { if(pitem->bEnable) { if(pitem->second) m_bCheckEverySeconds = TRUE; else if(pitem->bInterval) { if(!pitem->bBootExec) pitem->tickLast = GetTickCount(); m_bCheckEverySeconds = TRUE; } if(pitem->bResumeExec) m_bCheckEverySeconds = TRUE; } pitem = pitem->next; } }
/*------------------------------------------------ initialize --------------------------------------------------*/ static void OnInit(HWND hDlg) { LOGFONT logfont; char s[MAX_PATH]; HFONT hfont; hfont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); if(hfont) { SendDlgItemMessage(hDlg, IDC_HELPURL, WM_SETFONT, (WPARAM)hfont, 0); SendDlgItemMessage(hDlg, IDC_LANGDLL, WM_SETFONT, (WPARAM)hfont, 0); } SendDlgItemMessage(hDlg, IDC_ABOUTICON, STM_SETIMAGE, IMAGE_ICON, (LPARAM)g_hIconTClock); hfontLink = (HFONT)SendMessage(hDlg, WM_GETFONT, 0, 0); GetObject(hfontLink, sizeof(LOGFONT), &logfont); logfont.lfUnderline = 1; hfontLink = CreateFontIndirect(&logfont); SendDlgItemMessage(hDlg, IDC_MAILTO, WM_SETFONT, (WPARAM)hfontLink, 0); SendDlgItemMessage(hDlg, IDC_HOMEPAGE, WM_SETFONT, (WPARAM)hfontLink, 0); if(hCurHand == NULL) hCurHand = LoadCursor(g_hInst, MAKEINTRESOURCE(IDC_HAND)); oldLabProc = (WNDPROC)GetWindowLongPtr(GetDlgItem(hDlg, IDC_MAILTO), GWLP_WNDPROC); SubclassWindow(GetDlgItem(hDlg, IDC_MAILTO), LabLinkProc); SubclassWindow(GetDlgItem(hDlg, IDC_HOMEPAGE), LabLinkProc); //hbrback = CreateSolidBrush(GetSysColor(COLOR_3DFACE)); GetMyRegStr("", "HelpURL", s, MAX_PATH, MyString(IDS_HELPURL)); if (!s[0]) lstrcpyn(s, MyString(IDS_HELPURL), MAX_PATH); SetDlgItemText(hDlg, IDC_HELPURL, s); GetMyRegStr("", "2chHelpURL", s, MAX_PATH, MyString(IDS_HELP2CH)); if (!s[0]) lstrcpyn(s, MyString(IDS_HELP2CH), MAX_PATH); SetDlgItemText(hDlg, IDC_HELP2CH, s); GetMyRegStr("", "LangDLL", s, MAX_PATH, ""); SetDlgItemText(hDlg, IDC_LANGDLL, s); }
/*------------------------------------------------ read settings of an alarm --------------------------------------------------*/ void ReadAutoExecFromReg(PAUTOEXECSTRUCT pAS, int num) { char subkey[20]; wsprintf(subkey, "AutoExec%d", num + 1); GetMyRegStr(subkey, "Name", pAS->name, 40, ""); pAS->bAutoExec = GetMyRegLong(subkey, "AutoExec", FALSE); pAS->hour = GetMyRegLong(subkey, "Hour", 0xffffff); pAS->minute1 = GetMyRegLong(subkey, "Minute1", 0); pAS->minute2 = GetMyRegLong(subkey, "Minute2", 0); GetMyRegStr(subkey, "File", pAS->fname, 1024, ""); pAS->days = GetMyRegLong(subkey, "Days", 0x7f); pAS->bOnBoot = GetMyRegLong(subkey, "OnBoot", FALSE); if(pAS->name[0] == 0) wsprintf(pAS->name, "自動実行%d", num); }
void showUserMenu(HWND hwnd, HWND hwndClicked, int xPos, int yPos, int btn, int clk) { LPMALLOC pMalloc; UNREFERENCED_PARAMETER(hwndClicked); if(SHGetMalloc(&pMalloc) == NOERROR) { HMENU hMenu; UINT uID; PLISTIDL pScan; char fname[1024]; char entry[20]; wsprintf(entry, "%d%dFile", btn, clk); GetMyRegStr("Mouse", entry, fname, 1024, ""); del_title(fname); hMenu = CreatePopupMenu(); if(hMenu == NULL) { return; } uItemID = 100; if ( AddUserMenu(hMenu, pMalloc, fname)) { if(hMenu != NULL) { if(!getODFlg++) GetODMenuState(); SetForegroundWindow98(hwnd); uID = (UINT)TrackPopupMenu( hMenu, TPM_RIGHTALIGN | TPM_BOTTOMALIGN | TPM_LEFTBUTTON | TPM_RETURNCMD, xPos, yPos, 0, hwnd, NULL); if(uID != 0) { pScan = g_ptListIDL; while(pScan != NULL) { if(pScan->uMenuID == uID) { ExecFile(hwnd, pScan->path); break; } pScan = pScan->next; } } } } DestroyUserMenu(); DestroyMenu(hMenu); } pMalloc->lpVtbl->Release(pMalloc); }
/*------------------------------------------------ enable/disable menu item --------------------------------------------------*/ void CheckMenu(HMENU hmenu) { char s[80]; EnableMenuItem(hmenu, IDC_TASKMAN, MF_BYCOMMAND|MF_ENABLED); EnableMenuItem(hmenu, IDC_SYNCTIME, MF_BYCOMMAND| (GetMyRegStr("SNTP", "Server", s, 80, "") > 0 ? MF_ENABLED:MF_GRAYED)); }
/*-------------------------------------------------- read settings ----------------------------------------------------*/ void InitStartMenuSetting(HWND hwndClock) { char fname[MAX_PATH], s[MAX_PATH]; m_bStartMenu = GetMyRegLong(NULL, "StartMenu", FALSE); m_bStartMenu = GetMyRegLong(m_section, "StartMenu", m_bStartMenu); m_alpha = GetMyRegLong(NULL, "AlphaStartMenu", 0); m_alpha = GetMyRegLong(m_section, "Alpha", m_alpha); m_alpha = 255 - (m_alpha * 255 / 100); if(m_alpha < 8) m_alpha = 8; else if(m_alpha > 255) m_alpha = 255; if(m_bStartMenu || m_alpha < 255) m_bSubclass = TRUE; if(!m_bStartMenu) return; m_colMenu = GetMyRegLong(NULL, "StartMenuCol", RGB(128, 128, 128)); m_colMenu = GetMyRegLong(m_section, "Color", m_colMenu); m_bTile = GetMyRegLong(NULL, "StartMenuTile", FALSE); m_bTile = GetMyRegLong(m_section, "Tile", m_bTile); GetMyRegStr(NULL, "StartMenuBmp", s, MAX_PATH, ""); GetMyRegStr(m_section, "Bitmap", fname, MAX_PATH, s); if(fname[0]) // load bitmap { char fname2[MAX_PATH]; RelToAbs(fname2, fname); m_hbmpMenu = ReadBitmap(hwndClock, fname2, FALSE); if(m_hbmpMenu) { HDC hdc; hdc = GetDC(hwndClock); m_hdcMemMenu = CreateCompatibleDC(hdc); SelectObject(m_hdcMemMenu, m_hbmpMenu); ReleaseDC(hwndClock, hdc); } } }
/*--------------------------------------------------- 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); }
/*------------------------------------------------ Initialization of "Font" combo box --------------------------------------------------*/ void InitFont(HWND hDlg) { char s[LF_FACESIZE]; GetMyRegStr("", "Font", s, LF_FACESIZE, ""); if(s[0] == 0) { GetDefaultFontName(s, "System"); } // common/combobox.c InitFontNameCombo(hDlg, IDC_FONT, s); }
/*--------------------------------------------------- load settings for time syncronizing ---------------------------------------------------*/ void InitSyncTimeSetting(void) { char section[] = "SNTP"; char s[80]; bSyncTimer = GetMyRegLong(section, "Timer", FALSE); bSyncADay = GetMyRegLong(section, "ADay", TRUE); nMinutes = GetMyRegLong(section, "Minutes", 60); bNoDial = FALSE; if(hRASAPI) bNoDial = GetMyRegLong(section, "NoDial", TRUE); nLastDay = GetMyRegLong(section, "LastDay", -1); GetMyRegStr(section, "Begin", s, 80, ""); if(s[0]) { time2int(&nHourStart, &nMinuteStart, s); GetMyRegStr(section, "End", s, 80, ""); if(s[0]) time2int(&nHourEnd, &nMinuteEnd, s); else nHourStart = nMinuteStart = -1; } }
/*------------------------------------------------ "Apply" button --------------------------------------------------*/ void OnApply(HWND hDlg) { char s[MAX_PATH], s2[MAX_PATH]; GetDlgItemText(hDlg, IDC_HELPURL, s, MAX_PATH); SetMyRegStr("", "HelpURL", s); GetDlgItemText(hDlg, IDC_HELP2CH, s, MAX_PATH); SetMyRegStr("", "2chHelpURL", s); GetMyRegStr("", "LangDLL", s2, MAX_PATH, ""); GetDlgItemText(hDlg, IDC_LANGDLL, s, MAX_PATH); if(strcmp(s, s2) != 0) g_bApplyLangDLL = TRUE; // reload language dll SetMyRegStr("", "LangDLL", s); }
/*------------------------------------------------ initialize --------------------------------------------------*/ void OnInit(HWND hDlg) { char s[MAX_PATH]; m_bInit = FALSE; // common/tclang.c SetDialogLanguage(hDlg, "AnalogClock", g_hfontDialog); CheckDlgButton(hDlg, IDC_ANALOGCLOCK, GetMyRegLong(m_section, "UseAnalogClock", FALSE)); OnAnalogClock(hDlg); InitColor(hDlg); CheckDlgButton(hDlg, IDC_HOURHANDBOLD, GetMyRegLong(m_section, "HourHandBold", FALSE)); CheckDlgButton(hDlg, IDC_MINHANDBOLD, GetMyRegLong(m_section, "MinHandBold", FALSE)); CheckRadioButton(hDlg, IDC_ANALOGPOSMIDDLE, IDC_ANALOGPOSRIGHT, GetMyRegLong(m_section, "AnalogClockPos", 0) + IDC_ANALOGPOSMIDDLE); UpDown_SetBuddy(hDlg, IDC_ANALOGHPOSSPIN, IDC_ANALOGHPOS); UpDown_SetRange(hDlg, IDC_ANALOGHPOSSPIN, 999, -999); UpDown_SetPos(hDlg, IDC_ANALOGHPOSSPIN, GetMyRegLong(m_section, "HorizontalPos", 0)); UpDown_SetBuddy(hDlg, IDC_ANALOGVPOSSPIN, IDC_ANALOGVPOS); UpDown_SetRange(hDlg, IDC_ANALOGVPOSSPIN, 999, -999); UpDown_SetPos(hDlg, IDC_ANALOGVPOSSPIN, GetMyRegLong(m_section, "VerticalPos", 0)); UpDown_SetBuddy(hDlg, IDC_ANALOGSIZESPIN, IDC_ANALOGSIZE); UpDown_SetRange(hDlg, IDC_ANALOGSIZESPIN, 99, 0); UpDown_SetPos(hDlg, IDC_ANALOGSIZESPIN, GetMyRegLong(m_section, "Size", 0)); GetMyRegStr(m_section, "Bitmap", s, MAX_PATH, ""); SetDlgItemText(hDlg, IDC_ANALOGBMP, s); m_bInit = TRUE; }
/*------------------------------------------------ set sizes to "Font Size" combo box --------------------------------------------------*/ void OnFont(HWND hDlg, BOOL bInit) { char s[160], size[10]; int charset; int index; if(bInit) // WM_INITDIALOG GetMyRegStr(NULL, "FontSize", size, 10, "9"); else // WM_COMMAND GetDlgItemText(hDlg, IDC_FONTSIZE, size, 10); CBGetLBText(hDlg, IDC_FONT, CBGetCurSel(hDlg, IDC_FONT), (LPARAM)s); charset = CBGetItemData(hDlg, IDC_FONT, CBGetCurSel(hDlg, IDC_FONT)); // common/combobox.c InitFontSizeCombo(hDlg, IDC_FONTSIZE, s, charset); index = CBFindStringExact(hDlg, IDC_FONTSIZE, size); if(index == CB_ERR) SetDlgItemText(hDlg, IDC_FONTSIZE, size); else CBSetCurSel(hDlg, IDC_FONTSIZE, index); }
/*------------------------------------------- Show "TClock Help" ---------------------------------------------*/ void MyHelp(HWND hwnd, const char *section) { char helpurl[MAX_PATH], title[MAX_PATH]; if(!g_langfile[0]) return; GetMyRegStr(NULL, "HelpURL", helpurl, MAX_PATH, ""); if(helpurl[0] == 0) { if(GetPrivateProfileString("Main", "HelpURL", "", helpurl, MAX_PATH, g_langfile) == 0) return; } if(GetPrivateProfileString(section, "HelpURL", "", title, MAX_PATH, g_langfile) == 0) return; if(strlen(helpurl) > 0 && helpurl[ strlen(helpurl) - 1 ] != '/') del_title(helpurl); add_title(helpurl, title); ShellExecute(hwnd, NULL, helpurl, NULL, "", SW_SHOW); }
/*------------------------------------------------ tell other programs that right-click menu is to open --------------------------------------------------*/ void SendOnContextMenu(void) { HWND hwndProg; char entry[20], buf[100], cname[80], num[20]; int i, msg; for(i = 0; ; i++) { wsprintf(entry, "App%d", i + 1); GetMyRegStr("OnContextMenu", entry, buf, 100, ""); if(!buf[0]) break; parse(cname, buf, 0, 80); if(!cname[0]) continue; parse(num, buf, 1, 20); if(!num[0]) continue; msg = atoi(num); hwndProg = FindWindow(cname, NULL); if(hwndProg) SendMessage(hwndProg, msg, 0, 0); } }
/*--------------------------------------------------- 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(<); 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); }
/*------------------------------------------- initialize main dialog ---------------------------------------------*/ void OnInit(HWND hDlg) { HICON hIcon; char section[20]; int i, count; TIMERSTRUCT item; PTIMERSTRUCT pitem; // common/tclang.c SetDialogLanguage(hDlg, "Timer", g_hfontDialog); hIcon = LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_TCLOCK)); SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon); // ../common/dialog.c SetMyDialgPos(hDlg, 32, 32); SendDlgItemMessage(hDlg, IDC_TIMERTEST, BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_hIconPlay); UpDown_SetBuddy(hDlg, IDC_TIMERSPIN1, IDC_TIMERMINUTE); UpDown_SetBuddy(hDlg, IDC_TIMERSPIN2, IDC_TIMERSECOND); UpDown_SetRange(hDlg, IDC_TIMERSPIN1, 1440, 0); UpDown_SetRange(hDlg, IDC_TIMERSPIN2, 59, 0); count = GetMyRegLong(NULL, "TimerNum", 0); m_pTimer = NULL; if(count > 0) { for(i = 0; i < count; i++) { memset(&item, 0, sizeof(TIMERSTRUCT)); wsprintf(section, "Timer%d", i + 1); GetMyRegStr(section, "Name", item.name, BUFSIZE_NAME, section); item.minute = GetMyRegLong(section, "Minute", 3); item.second = GetMyRegLong(section, "Second", 0); GetMyRegStr(section, "File", item.fname, MAX_PATH, ""); item.bRepeat = GetMyRegLong(section, "Repeat", FALSE); item.bBlink = GetMyRegLong(section, "Blink", FALSE); item.bDisp = GetMyRegLong(section, "Disp", FALSE); item.nDispType = GetMyRegLong(section, "DispType", 1); item.nUserStr = GetMyRegLong(section, "UserStr", 0); m_pTimer = copy_listitem(m_pTimer, &item, sizeof(TIMERSTRUCT)); // common/list.c } } else { memset(&item, 0, sizeof(TIMERSTRUCT)); strcpy(item.name, "Timer1"); item.minute = 3; item.nDispType = 1; m_pTimer = copy_listitem(m_pTimer, &item, sizeof(TIMERSTRUCT)); } pitem = m_pTimer; while(pitem) { CBAddString(hDlg, IDC_TIMERNAME, (LPARAM)pitem->name); pitem = pitem->next; } m_nCurrent = -1; CBSetCurSel(hDlg, IDC_TIMERNAME, 0); OnName(hDlg); }
/*------------------------------------------------ Initialize the "Format" page --------------------------------------------------*/ void OnInit(HWND hDlg) { HFONT hfont; char s[BUFSIZE_FORMAT]; int i, ilang; // common/tclang.c SetDialogLanguage(hDlg, "Format", g_hfontDialog); hfont = (HFONT)GetStockObject(SYSTEM_FIXED_FONT); if(hfont) SendDlgItemMessage(hDlg, IDC_FORMAT, WM_SETFONT, (WPARAM)hfont, 0); // "Locale" combobox ilang = GetMyRegLong("", "Locale", (int)GetUserDefaultLangID()); InitLocaleCombo(hDlg, IDC_LOCALE, ilang); // common/combobox.c InitAutoFormat(ilang); // common/autoformat.c // "year" -- "second" for(i = IDC_YEAR4; i <= IDC_KAIGYO; i++) { CheckDlgButton(hDlg, i, GetMyRegLong("", ENTRY(i), TRUE)); } if(IsDlgButtonChecked(hDlg, IDC_YEAR)) CheckRadioButton(hDlg, IDC_YEAR4, IDC_YEAR, IDC_YEAR); if(IsDlgButtonChecked(hDlg, IDC_YEAR4)) CheckRadioButton(hDlg, IDC_YEAR4, IDC_YEAR, IDC_YEAR4); if(IsDlgButtonChecked(hDlg, IDC_MONTH)) CheckRadioButton(hDlg, IDC_MONTH, IDC_MONTHS, IDC_MONTH); if(IsDlgButtonChecked(hDlg, IDC_MONTHS)) CheckRadioButton(hDlg, IDC_MONTH, IDC_MONTHS, IDC_MONTHS); // "Internet Time" -- "Customize format" for(i = IDC_AMPM; i <= IDC_CUSTOM; i++) { CheckDlgButton(hDlg, i, GetMyRegLong("", ENTRY(i), FALSE)); } GetMyRegStr("", "Format", s, BUFSIZE_FORMAT, ""); SetDlgItemText(hDlg, IDC_FORMAT, s); GetMyRegStr("", "CustomFormat", m_CustomFormat, BUFSIZE_FORMAT, ""); On12Hour(hDlg); OnCustom(hDlg, FALSE); #if TC_ENABLE_SYSINFO // "Update interval" UpDown_SetBuddy(hDlg, IDC_SYSIISPIN, IDC_SYSII); UpDown_SetRange(hDlg, IDC_SYSIISPIN, 60, 1); i = GetMyRegLong(NULL, "IntervalSysInfo", 4); if(i < 1 || 60 < i) i = 4; UpDown_SetPos(hDlg, IDC_SYSIISPIN, i); #endif m_bInit = TRUE; }
/*------------------------------------------------ ページの初期化 --------------------------------------------------*/ void OnInit(HWND hDlg) { char s[1024]; HFONT hfont; DWORD dw; hfont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); if(hfont) SendDlgItemMessage(hDlg, IDC_COMDESKCAL, WM_SETFONT, (WPARAM)hfont, 0); CheckDlgButton(hDlg, IDC_NOCLOCK, GetMyRegLong("", "NoClock", FALSE)); CheckDlgButton(hDlg, IDC_MCIWAVE, GetMyRegLong("", "MCIWave", FALSE)); SendDlgItemMessage(hDlg, IDC_SPINDELAYSTART, UDM_SETRANGE, 0, MAKELONG(600, 0)); SendDlgItemMessage(hDlg, IDC_SPINDELAYSTART, UDM_SETPOS, 0, (int)(short)GetMyRegLong("", "DelayStart", 0)); SendDlgItemMessage(hDlg, IDC_SPINDELAYNET, UDM_SETRANGE, 0, MAKELONG(600, 0)); SendDlgItemMessage(hDlg, IDC_SPINDELAYNET, UDM_SETPOS, 0, (int)(short)GetMyRegLong("", "DelayNet", 0)); SendDlgItemMessage(hDlg, IDC_SPINCHECKNETINTERVAL, UDM_SETRANGE, 0, MAKELONG(0, 600)); SendDlgItemMessage(hDlg, IDC_SPINCHECKNETINTERVAL, UDM_SETPOS, 0, (int)(short)GetMyRegLong("", "NetRestartInterval", 0)); CheckDlgButton(hDlg, IDC_DESKCAL, GetMyRegLong("", "Deskcal", FALSE)); CheckDlgButton(hDlg, IDC_CHECKNETWORK, GetMyRegLong("", "DoNetRestart", FALSE)); GetMyRegStr("", "DeskcalCommand", s, 1024, ""); if(s[0] == '\0') { GetRegStr(HKEY_CURRENT_USER, "Software\\Shinonon\\Deskcal", "ExeFileName", s, 1024, ""); } SetDlgItemText(hDlg, IDC_COMDESKCAL, s); CheckDlgButton(hDlg, IDC_ONLYDATECHANGED, GetMyRegLong("", "DeskcalOnlyDate", FALSE)); CheckDlgButton(hDlg, IDC_RESUMESUSPEND, GetMyRegLong("", "DeskcalResumeSuspend", FALSE)); CheckDlgButton(hDlg, IDC_TONIKAKU, GetMyRegLong("", "DeskcalTonikaku", FALSE)); CheckDlgButton(hDlg, IDC_WATCHWALL, GetMyRegLong("", "WatchWallpaper", FALSE)); CheckDlgButton(hDlg, IDC_TASKWNDCTRL, GetMyRegLong("", "WatchTaskbarWindow", FALSE)); dw = GetMyRegLong(NULL, "ConfigMax", 1); if(dw > 30) dw = 30; if(dw < 1 ) dw = 1; SendDlgItemMessage(hDlg,IDC_CFMAXSPIN,UDM_SETRANGE,0, (LPARAM) MAKELONG((short)30, (short)1)); SendDlgItemMessage(hDlg, IDC_CFMAXSPIN, UDM_SETPOS, 0, (int)(short)dw); OnDeskcal(hDlg); OnCheckNet(hDlg); }