//================================================================================================ //-----------------------------------------------------+++--> T-Clock Menu Command Message Handler: LRESULT OnTClockCommand(HWND hwnd, WPARAM wParam) //----------------------------------+++--> { WORD wID = LOWORD(wParam); switch(wID) { case IDM_REFRESHTCLOCK: RefreshUs(); break; case IDM_SHOWPROP: MyPropertySheet(-1); break; case IDM_PROP_ALARM: MyPropertySheet(1); break; case IDM_EXIT: SendMessage(hwnd,WM_CLOSE,0,0); break; case IDM_SHOWCALENDER: ToggleCalendar(1); // 1=own calendar break; case IDM_DISPLAYPROP: if(api.OS >= TOS_VISTA) api.Exec(L"::{26EE0668-A00A-44D7-9371-BEB064C98683}\\1\\::{C555438B-3C23-4769-A71F-B6D3D9B6053A}", NULL, NULL); else api.Exec(L"control", L"desk.cpl, display,1", NULL); break; case IDM_VOLUMECONTROL: //-------------------------------+++--> Volume Controls #ifndef _WIN64 # define OPEN_VOLUME L"SndVol32" #else # define OPEN_VOLUME L"SndVol" #endif // _WIN64 api.Exec(OPEN_VOLUME, NULL, NULL); break; case IDM_AUDIOPROP: //----------------------------------+++--> Audio settings / devices api.Exec(L"control", L"mmsys.cpl", NULL); break; case IDM_RECYCLEBIN: api.Exec(L"::{645FF040-5081-101B-9F08-00AA002F954E}", NULL, NULL); break; case IDM_RECYCLEBIN_PURGE:{ SHQUERYRBINFO info = {sizeof(info)}; // Windows seriously asks : SHQueryRecycleBin(NULL, &info); // "are you sure to delete all items" if(info.i64NumItems > 0 || api.OS == TOS_2000) // when the recycle bin is actually empty... SHEmptyRecycleBin(g_hwndTClockMain, NULL, 0); break;} case IDM_MAPDRIVE: //----------------------------------+++--> Map Network Drive WNetConnectionDialog(hwnd, RESOURCETYPE_DISK); break; case IDM_DISCONNECT: //-------------------------+++--> Disconnect Network Drive WNetDisconnectDialog(hwnd, RESOURCETYPE_DISK); break; case IDM_TOGGLE_DT: //---------------------------+++--> Show / Hide the Desktop ToggleDesk(); break; case IDM_QUICKY_WINEXP: { //-----------------//--+++--> Windows Explorer Opened api.Exec(L"Explorer", L"/e, ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", hwnd); break;} case IDM_QUICKY_DOS: { // Command Prompt api.Exec(L"cmd", L"/f:on /t:0a", hwnd); break;} case IDM_QUICKY_EMPTYRB: SHEmptyRecycleBin(0, NULL, SHERB_NOCONFIRMATION); break; case IDM_SHUTDOWN: if(!ShutDown()) MessageBox(0, L"Shutdown Request Failed!", L"ERROR", MB_OK|MB_ICONERROR|MB_SETFOREGROUND); break; case IDM_REBOOT: if(!ReBoot()) MessageBox(0, L"Reboot Request Failed!", L"ERROR", MB_OK|MB_ICONERROR|MB_SETFOREGROUND); break; case IDM_LOGOFF: if(!LogOff()) MessageBox(0, L"Logoff Request Failed!", L"ERROR", MB_OK|MB_ICONERROR|MB_SETFOREGROUND); break; case IDM_FWD_CASCADE: case IDM_FWD_SIDEBYSIDE: case IDM_FWD_STACKED: case IDM_FWD_SHOWDESKTOP: case IDM_FWD_MINALL: case IDM_FWD_UNDO: g_undo=(wID!=IDM_FWD_UNDO); /* fall through */ case IDM_FWD_DATETIME: case IDM_FWD_CUSTOMNOTIFYICONS: case IDM_FWD_TASKMAN: case IDM_FWD_LOCKTASKBAR: case IDM_FWD_LOCKALLTASKBAR: case IDM_FWD_TASKBARPROP: case IDM_FWD_RUNAPP: case IDM_FWD_EXITEXPLORER:{ HWND hwndTray = FindWindowA("Shell_TrayWnd", NULL); if(hwndTray) PostMessage(hwndTray, WM_COMMAND, wID, 0); break;} case IDM_DATETIME_EX:{ HWND hwnd1, hwnd2; int wait = 40; api.Exec(L"timedate.cpl", L"", 0); while((hwnd2=FindWindowA((char*)(uintptr_t)32770,"Date and Time"))==0 && wait--) Sleep(50); if(hwnd2){ SetActiveWindow(hwnd2); wait = 10; while((hwnd1=FindWindowExA(hwnd2,NULL,(char*)(uintptr_t)32770,"Date and Time"))==0 && wait--) Sleep(50); if(hwnd1){ hwnd2 = GetDlgItem(hwnd1,116); if(hwnd2) PostMessage(hwnd2,BM_CLICK,0,0); } } break;} case IDM_CHIME: /// Alarms AlarmChimeEnable(-1); break; case IDM_STOPWATCH: /// Timers DialogStopWatch(); break; case IDM_STOPWATCH_START: case IDM_STOPWATCH_RESUME: if(!IsWindow(g_hDlgStopWatch)) DialogStopWatch(); StopWatch_Resume(g_hDlgStopWatch); break; case IDM_STOPWATCH_STOP: case IDM_STOPWATCH_PAUSE: if(IsWindow(g_hDlgStopWatch)) StopWatch_Pause(g_hDlgStopWatch); break; case IDM_STOPWATCH_RESET: if(IsWindow(g_hDlgStopWatch)) StopWatch_Reset(g_hDlgStopWatch); break; case IDM_STOPWATCH_LAP: if(IsWindow(g_hDlgStopWatch)) StopWatch_Lap(g_hDlgStopWatch,0); break; case IDM_TIMER: DialogTimer(0); break; case IDM_TIMEWATCH: WatchTimer(0); // Shelter All the Homeless Timers. break; case IDM_TIMEWATCHRESET: WatchTimer(1); // Shelter All the Homeless Timers. break; case IDM_SNTP:{ short just_elevated = HIWORD(wParam); if(!just_elevated || HaveSetTimePermissions()) { ReplyMessage(1); NetTimeConfigDialog(0); return 1; // handled } else { if(IsWindow(g_hDlgSNTP)) SendMessage(g_hDlgSNTP, WM_CLOSE, 1, 0); // close window but safe changes } return 0;} case IDM_SYNCTIME: case IDM_SNTP_SYNC:{ short just_elevated = HIWORD(wParam); int can_sync = HaveSetTimePermissions(); if(!just_elevated || can_sync) { ReplyMessage(1); if(can_sync) { SyncTimeNow(); } else { if(api.ExecElevated(GetClockExe(),L"/UAC /Sync",NULL) != 0) { MessageBox(0, L"T-Clock must be elevated to set your system time,\nbut elevation was canceled", L"Time Sync Failed", MB_OK|MB_ICONERROR|MB_SETFOREGROUND); } } return 1; // handled } return 0;} default: #ifdef _DEBUG DBGOUT("%s: unknown ID: %.5i(0x%.4x) (hwnd:%p)", __FUNCTION__, wID, wID, hwnd); #endif // _DEBUG break; } return 0; }
/*! プロパティシートの作成 @date 2002.2.17 YAZAKI CShareDataのインスタンスは、CProcessにひとつあるのみ。 */ INT_PTR CPropCommon::DoPropertySheet( int nPageNum, bool bTrayProc ) { INT_PTR nRet; int nIdx; m_bTrayProc = bTrayProc; // From Here Jun. 2, 2001 genta // Feb. 11, 2007 genta URLをTABと入れ換え // 2007.02.13 順序変更(TABをWINの次に) //! 「共通設定」プロパティシートの作成時に必要な情報の配列. // 順序変更 Win,Toolbar,Tab,Statusbarの順に、File,FileName 順に 2008/6/22 Uchi // DProcの変更 2010/5/9 Uchi static const ComPropSheetInfo ComPropSheetInfoList[] = { { STR_PROPCOMMON_GENERAL, IDD_PROP_GENERAL, CPropGeneral::DlgProc_page }, { STR_PROPCOMMON_WINDOW, IDD_PROP_WIN, CPropWin::DlgProc_page }, { STR_PROPCOMMON_MAINMENU, IDD_PROP_MAINMENU, CPropMainMenu::DlgProc_page }, // 2010/5/8 Uchi { STR_PROPCOMMON_TOOLBAR, IDD_PROP_TOOLBAR, CPropToolbar::DlgProc_page }, { STR_PROPCOMMON_TABS, IDD_PROP_TAB, CPropTab::DlgProc_page }, { STR_PROPCOMMON_STATBAR, IDD_PROP_STATUSBAR, CPropStatusbar::DlgProc_page }, // 文字コード表示指定 2008/6/21 Uchi { STR_PROPCOMMON_EDITING, IDD_PROP_EDIT, CPropEdit::DlgProc_page }, { STR_PROPCOMMON_FILE, IDD_PROP_FILE, CPropFile::DlgProc_page }, { STR_PROPCOMMON_FILENAME, IDD_PROP_FNAME, CPropFileName::DlgProc_page }, { STR_PROPCOMMON_BACKUP, IDD_PROP_BACKUP, CPropBackup::DlgProc_page }, { STR_PROPCOMMON_FORMAT, IDD_PROP_FORMAT, CPropFormat::DlgProc_page }, { STR_PROPCOMMON_SEARCH, IDD_PROP_GREP, CPropGrep::DlgProc_page }, // 2006.08.23 ryoji タイトル変更(Grep -> 検索) { STR_PROPCOMMON_KEYS, IDD_PROP_KEYBIND, CPropKeybind::DlgProc_page }, { STR_PROPCOMMON_CUSTMENU, IDD_PROP_CUSTMENU, CPropCustmenu::DlgProc_page }, { STR_PROPCOMMON_KEYWORD, IDD_PROP_KEYWORD, CPropKeyword::DlgProc_page }, { STR_PROPCOMMON_SUPPORT, IDD_PROP_HELPER, CPropHelper::DlgProc_page }, { STR_PROPCOMMON_MACRO, IDD_PROP_MACRO, CPropMacro::DlgProc_page }, { STR_PROPCOMMON_PLUGIN, IDD_PROP_PLUGIN, CPropPlugin::DlgProc_page }, }; std::tstring sTabname[_countof(ComPropSheetInfoList)]; PROPSHEETPAGE psp[_countof(ComPropSheetInfoList)]; for( nIdx = 0; nIdx < _countof(ComPropSheetInfoList); nIdx++ ){ sTabname[nIdx] = LS(ComPropSheetInfoList[nIdx].m_nTabNameId); PROPSHEETPAGE *p = &psp[nIdx]; memset_raw( p, 0, sizeof_raw( *p ) ); p->dwSize = sizeof_raw( *p ); p->dwFlags = PSP_USETITLE | PSP_HASHELP; p->hInstance = CSelectLang::getLangRsrcInstance(); p->pszTemplate = MAKEINTRESOURCE( ComPropSheetInfoList[nIdx].resId ); p->pszIcon = NULL; p->pfnDlgProc = ComPropSheetInfoList[nIdx].DProc; p->pszTitle = sTabname[nIdx].c_str(); p->lParam = (LPARAM)this; p->pfnCallback = NULL; } // To Here Jun. 2, 2001 genta PROPSHEETHEADER psh; memset_raw( &psh, 0, sizeof_raw( psh ) ); // Jun. 29, 2002 こおり // Windows 95対策.Property SheetのサイズをWindows95が認識できる物に固定する. psh.dwSize = sizeof_old_PROPSHEETHEADER; // JEPROtest Sept. 30, 2000 共通設定の隠れ[適用]ボタンの正体はここ。行頭のコメントアウトを入れ替えてみればわかる psh.dwFlags = PSH_NOAPPLYNOW | PSH_PROPSHEETPAGE | PSH_USEPAGELANG; psh.hwndParent = m_hwndParent; psh.hInstance = CSelectLang::getLangRsrcInstance(); psh.pszIcon = NULL; psh.pszCaption = LS( STR_PROPCOMMON ); //_T("共通設定"); psh.nPages = nIdx; //- 20020106 aroka # psh.nStartPage は unsigned なので負にならない if( -1 == nPageNum ){ psh.nStartPage = m_nPageNum; }else if( 0 > nPageNum ){ //- 20020106 aroka psh.nStartPage = 0; }else{ psh.nStartPage = nPageNum; } if( psh.nPages - 1 < psh.nStartPage ){ psh.nStartPage = psh.nPages - 1; } psh.ppsp = psp; psh.pfnCallback = NULL; nRet = MyPropertySheet( &psh ); // 2007.05.24 ryoji 独自拡張プロパティシート if( -1 == nRet ){ TCHAR* pszMsgBuf; ::FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, ::GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // デフォルト言語 (LPTSTR)&pszMsgBuf, 0, NULL ); PleaseReportToAuthor( NULL, LS(STR_ERR_DLGPROPCOMMON24), psh.nStartPage, pszMsgBuf ); ::LocalFree( pszMsgBuf ); } return nRet; }