int __stdcall WinMain(HINSTANCE hinst, HINSTANCE, PSTR cmdLine, int cmdShow) { _Module.Init(0, hinst, 0); CMessageLoop msgLoop; _Module.AddMessageLoop(&msgLoop); int result = -1; CMainFrame frame; frame.Create( ::GetDesktopWindow(), CWindow::rcDefault, TEXT("Notepad--")); if (frame.IsWindow()) { frame.ShowWindow(cmdShow); result = msgLoop.Run(); } _Module.RemoveMessageLoop(); _Module.Term(); return result; }
extern "C" __declspec(dllexport) void LoadLuaRunTime(char* szInstallDir) { TSTRACEAUTO(); HRESULT hr = ::CoInitialize(NULL); hr = _Module.Init(NULL, gInstance); CMessageLoop theLoop; _Module.AddMessageLoop(&theLoop); CLRTAgent lrtAgent; //lrtAgent.InitLua(szInstallDir); //g_hXappLuaToolDll = lrtAgent.GetXappLuaToolDllModuleHandle(); if (lrtAgent.InitLua(szInstallDir)) { TSDEBUG4CXX(_T(">>>>>theLoop.Run()")); theLoop.Run(); TSDEBUG4CXX(_T("<<<<<theLoop.Run()")); } _Module.RemoveMessageLoop(); _Module.Term(); ::CoUninitialize(); TerminateProcess(::GetCurrentProcess(), S_OK); return; }
LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // create command bar window HWND hWndCmdBar = m_CmdBar.Create(m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE); // attach menu m_CmdBar.AttachMenu(GetMenu()); // load command bar images m_CmdBar.LoadImages(IDR_MAINFRAME); // remove old menu SetMenu(NULL); HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd, IDR_MAINFRAME, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE); CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE); AddSimpleReBarBand(hWndCmdBar); AddSimpleReBarBand(hWndToolBar, NULL, TRUE); CreateSimpleStatusBar(); m_hWndClient = m_view.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_HSCROLL | WS_VSCROLL, WS_EX_CLIENTEDGE); m_view.SetScrollSize(1,1); UIAddToolBar(hWndToolBar); UISetCheck(ID_VIEW_TOOLBAR, 1); UISetCheck(ID_VIEW_STATUS_BAR, 1); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); return 0; }
void CDLListWindow::OnClose() { /* 設定を保存する */ CIniFileO pr(CDLOptions::s_DLIniFilePath, _T("DLList")); CRect rc; GetWindowRect(&rc); pr.SetValue(rc.top, _T("top")); pr.SetValue(rc.left, _T("left")); pr.SetValue(rc.right, _T("right")); pr.SetValue(rc.bottom, _T("bottom")); pr.SetValue(m_cmbParallelDL.GetCurSel(), _T("ParallelDL")); pr.SetValue(m_DLList.GetColumnWidth(0), _T("ColumnWidthURL")); CString strPath = MtlGetWindowText(m_cmbDLFolder); CDLOptions::_SavePathHistory(strPath, CDLOptions::s_vecImageDLFolderHistory); pr.SetValue(m_cmbDLOption.GetCurSel(), _T("DLOption")); RevokeDragDrop(); CMessageLoop *pLoop = _Module.GetMessageLoop(); pLoop->RemoveMessageFilter(this); DestroyWindow(); }
int App::Run(LPCTSTR /*lpstrCmdLine*/, int nCmdShow) { if (!ParseCommandLine()) return 0; CMessageLoop theLoop; _Module.AddMessageLoop(&theLoop); MainFrame wndMain; if (!m_cszFilename.IsEmpty()) wndMain.OpenFileAtStart(m_cszFilename); if (wndMain.CreateEx() == nullptr) { ATLTRACE(_T("Main window creation failed!\n")); return 0; } wndMain.ShowWindow(nCmdShow); int nRet = theLoop.Run(); _Module.RemoveMessageLoop(); return nRet; }
LRESULT FormEditorWin::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); pLoop->AddMessageFilter(this); return 0; }
LRESULT CMainDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // center the dialog on the screen CenterWindow(); // set icons HICON hIcon = AtlLoadIconImage(IDR_MAINFRAME, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON)); SetIcon(hIcon, TRUE); HICON hIconSmall = AtlLoadIconImage(IDR_MAINFRAME, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON)); SetIcon(hIconSmall, FALSE); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); UIAddChildWindowContainer(m_hWnd); ctl_info_.Attach(GetDlgItem(IDC_LST_INFO)); SetDlgItemInt(IDC_TXT_LEVEL, -100, TRUE); SetDlgItemInt(IDC_TXT_SCALER, -100, TRUE); SetTimer(TIMER_ID_VOLINFO, 2000, 0); return TRUE; }
CNoteDlg::~CNoteDlg() { ATLTRACE(_T("CNoteDlg::~CNoteDlg()\n")); // Destroy the brush if (!m_brBkgnd.DeleteObject()) ATLTRACE(_T("Note's brush was not destroyed!\n")); // Destroy the bitmaps if (!::DeleteObject(m_hBmpNote)) ATLTRACE(_T("Note bitmap was not destroyed!\n")); if (!::DeleteObject(m_hBmpPinopen)) ATLTRACE(_T("Pinopen bitmap was not destroyed!\n")); if (!::DeleteObject(m_hBmpPinclose)) ATLTRACE(_T("Pinclose bitmap was not destroyed!\n")); if (!::DeleteObject(m_hBmpPinhoover)) ATLTRACE(_T("Pinhoover bitmap was not destroyed!\n")); // Destroy the font if (!::DeleteObject(m_hFontClose)) ATLTRACE(_T("Font for a close button was not destroyed!\n")); m_Printer.ClosePrinter(); CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->RemoveMessageFilter(this); pLoop->RemoveIdleHandler(this); }
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT) { CMessageLoop theLoop; _Module.AddMessageLoop(&theLoop); CMainFrame wndMain; if(wndMain.CreateEx() == NULL) { ATLTRACE(_T("Main window creation failed!\n")); return 0; } wndMain.ShowWindow(nCmdShow); int nRet = theLoop.Run(); _Module.RemoveMessageLoop(); duWindowManager *wndManager_ = wndMain.getWindowManager(); if (NULL != wndManager_) { ReleaseStyle(wndManager_); } return nRet; }
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT) { CMessageLoop theLoop; _Module.AddMessageLoop(&theLoop); CMainFrame wndMain; CComArenaHook hook; //hook.open(); //hook.demo7(); hook.JobShopBuilder(); if(wndMain.CreateEx() == NULL) { ATLTRACE(_T("Main window creation failed!\n")); return 0; } wndMain.ShowWindow(nCmdShow); int nRet = theLoop.Run(); _Module.RemoveMessageLoop(); return nRet; }
//====================== // 関連付け動作設定画面 //====================== LRESULT CConfigDlgOpenAction::OnInitDialog(HWND hWnd, LPARAM lParam) { // メッセージループにメッセージフィルタとアイドルハンドラを追加 CMessageLoop* pLoop = _Module.GetMessageLoop(); pLoop->AddMessageFilter(this); //---------------- // 開く動作の設定 //---------------- //---通常 Radio_OpenAction[OPENACTION_EXTRACT]=GetDlgItem(IDC_RADIO_OPENACTION_EXTRACT); Radio_OpenAction[OPENACTION_LIST]=GetDlgItem(IDC_RADIO_OPENACTION_LIST); Radio_OpenAction[OPENACTION_TEST]=GetDlgItem(IDC_RADIO_OPENACTION_TEST); Radio_OpenAction[OPENACTION_ASK]=GetDlgItem(IDC_RADIO_OPENACTION_ASK); Radio_OpenAction[m_Config.OpenAction].SetCheck(true); //---Shift押下時 Radio_OpenAction_Shift[OPENACTION_EXTRACT]=GetDlgItem(IDC_RADIO_OPENACTION_EXTRACT_SHIFT); Radio_OpenAction_Shift[OPENACTION_LIST]=GetDlgItem(IDC_RADIO_OPENACTION_LIST_SHIFT); Radio_OpenAction_Shift[OPENACTION_TEST]=GetDlgItem(IDC_RADIO_OPENACTION_TEST_SHIFT); Radio_OpenAction_Shift[OPENACTION_ASK]=GetDlgItem(IDC_RADIO_OPENACTION_ASK_SHIFT); Radio_OpenAction_Shift[m_Config.OpenAction_Shift].SetCheck(true); //---Ctrl押下時 Radio_OpenAction_Ctrl[OPENACTION_EXTRACT]=GetDlgItem(IDC_RADIO_OPENACTION_EXTRACT_CTRL); Radio_OpenAction_Ctrl[OPENACTION_LIST]=GetDlgItem(IDC_RADIO_OPENACTION_LIST_CTRL); Radio_OpenAction_Ctrl[OPENACTION_TEST]=GetDlgItem(IDC_RADIO_OPENACTION_TEST_CTRL); Radio_OpenAction_Ctrl[OPENACTION_ASK]=GetDlgItem(IDC_RADIO_OPENACTION_ASK_CTRL); Radio_OpenAction_Ctrl[m_Config.OpenAction_Ctrl].SetCheck(true); return TRUE; }
int Run(LPTSTR lpstrCmdLine = NULL, int nCmdShow = SW_SHOWDEFAULT) { CMessageLoop theLoop; _Module.AddMessageLoop(&theLoop); CMainDlg dlgMain; if(dlgMain.Create(NULL) == NULL) { ATLTRACE(_T("Main dialog creation failed!\n")); return 0; } if(dlgMain.openPreview() == NULL) { ATLTRACE(_T("Preview Window creation failed!\n")); return 0; } dlgMain.ShowWindow(nCmdShow); if(lpstrCmdLine){ char buf[256]; wcstombs(buf, lpstrCmdLine, sizeof buf); dlgMain.OpenModel(buf); } int nRet = theLoop.Run(); _Module.RemoveMessageLoop(); return nRet; }
LRESULT CMainDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // center the dialog on the screen CenterWindow(); // set icons HICON hIcon = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME), IMAGE_ICON, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON), LR_DEFAULTCOLOR); SetIcon(hIcon, TRUE); HICON hIconSmall = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR); SetIcon(hIconSmall, FALSE); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); UIAddChildWindowContainer(m_hWnd); //int cxScreen,cyScreen; //cxScreen = GetSystemMetrics(SM_CXSCREEN); //cyScreen = GetSystemMetrics(SM_CYSCREEN); //SetWindowPos(::GetForegroundWindow(), 0, 0, cxScreen, cyScreen, SWP_SHOWWINDOW); //SetWindowPos(::GetForegroundWindow(),0,0,0,0,SWP_SHOWWINDOW); ::SetWindowPos(m_hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW); return TRUE; }
LRESULT CResendDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { CString sRTL = Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("Settings"), _T("RTLReading")); if(sRTL.CompareNoCase(_T("1"))==0) { Utility::SetLayoutRTL(m_hWnd); } SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("DlgCaption"))); // center the dialog on the screen CenterWindow(); // Set window icon SetIcon(::LoadIcon(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME)), 0); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); ShowWindow(SW_SHOW); return TRUE; }
LRESULT MainFrameBase::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE); SetupCmdbar(); //SetupToolbar(); CreateSimpleStatusBar(); UISetCheck(ID_VIEW_STATUS_BAR, 1); SetupMDIClient(); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); // floating stuff InitializeDockingFrame(); UpdateLayout(); return 0; }
LRESULT CLoginDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // center the dialog on the screen CenterWindow(); // set icons HICON hIcon = AtlLoadIconImage(IDR_MAINFRAME, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON)); SetIcon(hIcon, TRUE); HICON hIconSmall = AtlLoadIconImage(IDR_MAINFRAME, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON)); SetIcon(hIconSmall, FALSE); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); UIAddChildWindowContainer(m_hWnd); HWND hWnd = GetDlgItem(IDC_GIF1); if (hWnd) { m_gifLogo.SubclassWindow(hWnd); if (m_gifLogo.Load(MAKEINTRESOURCE(IDR_GIF1),_T("GIF"))) m_gifLogo.Draw(); } return TRUE; }
LRESULT CMainFrame::OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->RemoveMessageFilter(this); pLoop->RemoveIdleHandler(this); // NOTE: the pane windows will delete themselves, // so we just need to remove them from the list m_PaneWindows.erase(m_PaneWindows.begin(),m_PaneWindows.end()); for(_PaneWindowIconsIter iter=m_PaneWindowIcons.begin(); iter!=m_PaneWindowIcons.end(); iter++) { ::DestroyIcon(*iter); *iter = NULL; } m_PaneWindowIcons.erase(m_PaneWindowIcons.begin(), m_PaneWindowIcons.end()); #ifdef DF_FOCUS_FEATURES m_focusHandler.RemoveHook(m_hWnd); #endif //map<VGMFile*, CItemTreeView*> itemViewMap; //map<HWND, CItemTreeView*> hwndToItemTreeView; //for (map<VGMFile*, CItemTreeView*>::iterator iter = itemViewMap.begin(); iter != itemViewMap.end(); iter++) // delete iter->second; //iter->second->DestroyWindow(); //for (map<HWND, CItemTreeView*>::iterator iter = hwndToItemTreeView.begin(); iter != hwndToItemTreeView.end(); iter++) // *iter->second->DestroyWindow(); //hwndToItemTreeView.clear(); PostQuitMessage(0); bHandled = TRUE; return 0; }
LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // create command bar window HWND hWndCmdBar = m_CmdBar.Create(m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE); // attach menu m_CmdBar.AttachMenu(GetMenu()); // load command bar images m_CmdBar.LoadImages(IDR_MAINFRAME); // remove old menu SetMenu(NULL); HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd, IDR_MAINFRAME, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE); CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE); AddSimpleReBarBand(hWndCmdBar); AddSimpleReBarBand(hWndToolBar, NULL, TRUE); CreateSimpleStatusBar(); UIAddToolBar(hWndToolBar); UISetCheck(ID_VIEW_TOOLBAR, 1); UISetCheck(ID_VIEW_STATUS_BAR, 1); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); // Create the splitter windows. const DWORD dwSplitStyle = CHILD_WND_STYLE; m_wndVerSplit1.Create (*this, rcDefault, NULL, dwSplitStyle); m_wndVerSplit1.m_bFullDrag = false; m_wndVerSplit1.m_cxyMin = 200; m_wndVerSplit1.SetSplitterPos(200); m_wndVerSplit2.Create(m_wndVerSplit1, rcDefault, NULL, dwSplitStyle); m_wndVerSplit2.m_bFullDrag = false; m_wndVerSplit2.m_cxyMin = 200; m_wndVerSplit2.SetSplitterPos(200); // Create splitter view const DWORD dwViewStyle = CHILD_WND_STYLE; const DWORD dwViewStyleEx = WS_EX_CLIENTEDGE; m_wndLeftView.Create(m_wndVerSplit1, rcDefault, NULL, dwViewStyle, dwViewStyleEx); m_wndMiddleView.Create(m_wndVerSplit2, rcDefault, NULL, dwViewStyle, dwViewStyleEx); m_wndRightView.Create(m_wndVerSplit2, rcDefault, NULL, dwViewStyle, dwViewStyleEx); m_wndVerSplit1.SetSplitterPanes(m_wndLeftView, m_wndVerSplit2); m_wndVerSplit2.SetSplitterPanes(m_wndMiddleView, m_wndRightView); m_hWndClient = m_wndVerSplit1; // Set the splitter as the client area window, and resize the splitter // to match the frame size. UpdateLayout(); return 0; }
LRESULT CConfigDlgDetail::OnInitDialog(HWND hWnd, LPARAM lParam) { // メッセージループにメッセージフィルタとアイドルハンドラを追加 CMessageLoop* pLoop = _Module.GetMessageLoop(); pLoop->AddMessageFilter(this); return TRUE; }
LRESULT CMiniPieFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { CAppInfo info; // Full screen mode delayed restoration bool bFull = false; info.Restore(bFull, L"Full"); if (bFull) PostMessage(WM_COMMAND, ID_VIEW_FULLSCREEN); CreateSimpleCEMenuBar(); #ifdef WIN32_PLATFORM_WFSP // SmartPhone AtlActivateBackKey(m_hWndCECommandBar); #endif UIAddToolBar(m_hWndCECommandBar); SetCommandButton(ID_APP_EXIT); // StatusBar state restoration bool bVisible = true; info.Restore(bVisible, L"Status"); DWORD dwStyle = WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | CCS_TOP; if (bVisible) dwStyle |= WS_VISIBLE; // StatusBar creation CreateSimpleStatusBar(ATL_IDS_IDLEMESSAGE, dwStyle); UIAddStatusBar(m_hWndStatusBar); UISetCheck(ID_VIEW_STATUS_BAR, bVisible); // Browser view creation m_hWndClient = m_browser.Create(m_hWnd, NULL, _T("Microsoft.PIEDocView"), WS_CHILD | WS_VISIBLE | WS_BORDER, 0, ID_BROWSER); ATLVERIFY(SUCCEEDED(m_browser.QueryControl(&m_spIWebBrowser2))); ATLVERIFY(SUCCEEDED(AtlAdviseSinkMap(this, true))); // Navigation menu initialization UIEnable(IDM_BACK, FALSE); UIEnable(IDM_FORWARD, FALSE); UIEnable(IDM_STOP, FALSE); UIEnable(IDM_REFRESH, FALSE); #ifdef WIN32_PLATFORM_PSPC // PPC Address bar state restoration VARIANT_BOOL vb = ATL_VARIANT_TRUE; info.Restore(vb, L"Address"); m_spIWebBrowser2->put_AddressBar(vb); UISetCheck(ID_VIEW_ADDRESSBAR, vb == ATL_VARIANT_TRUE); #endif // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); return 0; }
LRESULT CPreviewWindow::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { CRegKey key; key.Open(HKEY_CURRENT_USER, lpcstrTG2RegKey, KEY_READ); DWORD tiled = 0, zoom = 4, alpha = 1; key.QueryDWORDValue(_T("TextureTiled"), tiled); key.QueryDWORDValue(_T("TextureZoom"), zoom); key.QueryDWORDValue(_T("TextureAlpha"), alpha); key.Close(); m_client.Create(m_hWnd, rcDefault, 0, WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN, 0); CFontHandle fnt = AtlGetDefaultGuiFont(); m_tile.Create(m_hWnd, CRect(2, 0, 36, 20), _T("tile"), WS_CHILD|WS_VISIBLE|FRBS_AUTO3D_SINGLE|FRBS_CHECK|FRBS_HOTTRACK|FRBS_SOLID|FRBS_AUTO, 0, 100); m_tile.SetFont(fnt); m_tile.SetCheck(tiled); m_tile.SetColorScheme(RGB(0, 0, 0), RGB(0, 0, 255), RGB(66, 65, 64), RGB(103, 99, 96), RGB(174, 169, 167), RGB(174, 169, 167), RGB(200, 198, 196)); m_client.SetTiled(tiled); if (zoom == 2) zoom++; // 1:3 is out m_zoom.Create(m_hWnd, CRect(40, 0, 100, 20), 0, WS_CHILD|WS_VISIBLE|FRBS_FLAT|FRBS_HOTTRACK, 0, 101); m_zoom.AddMenuItem(1, "1:4"); m_zoom.AddMenuItem(3, "1:2"); m_zoom.AddMenuItem(4, "1:1"); m_zoom.AddMenuItem(5, "2:1"); m_zoom.AddMenuItem(6, "3:1"); m_zoom.AddMenuItem(7, "4:1"); m_zoom.SetSelection(zoom); m_zoom.SetFont(fnt); m_zoom.SetColorScheme(RGB(0, 0, 0), RGB(0, 0, 255), RGB(66, 65, 64), RGB(103, 99, 96), RGB(174, 169, 167), RGB(174, 169, 167), RGB(200, 198, 196)); m_alpha.Create(m_hWnd, CRect(104, 0, 174, 20), 0, WS_CHILD|WS_VISIBLE|FRBS_FLAT|FRBS_HOTTRACK, 0, 102); m_alpha.AddMenuItem(1, "no alpha"); m_alpha.AddMenuItem(2, "photoshop"); m_alpha.SetSelection(alpha); m_alpha.SetFont(fnt); m_alpha.SetColorScheme(RGB(0, 0, 0), RGB(0, 0, 255), RGB(66, 65, 64), RGB(103, 99, 96), RGB(174, 169, 167), RGB(174, 169, 167), RGB(200, 198, 196)); m_client.SetAlphaMode(alpha - 1); static const sInt s1tab[] = { 1, 1, 1, 1, 2, 3, 4 }; static const sInt s2tab[] = { 4, 3, 2, 1, 1, 1, 1 }; m_client.SetScale(s1tab[zoom - 1], s2tab[zoom - 1]); CMessageLoop* pLoop = _Module.GetMessageLoop(); pLoop->AddMessageFilter(this); m_bgBrush.CreateSolidBrush(RGB(174, 169, 167)); bHandled = FALSE; return 0; }
LRESULT CPictureSettingDlg::OnDestroy( UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/ ) { m_previewDlg.DestroyWindow(); CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->RemoveMessageFilter(this); pLoop->RemoveIdleHandler(this); return 0; }
LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // Check if Common Controls 6.0 are used. If yes, use 32-bit (alpha) images // for the toolbar and command bar. If not, use the old, 4-bit images. UINT uResID = IDR_MAINFRAME_OLD; DWORD dwMajor = 0; DWORD dwMinor = 0; HRESULT hRet = AtlGetCommCtrlVersion(&dwMajor, &dwMinor); if(SUCCEEDED(hRet) && dwMajor >= 6) uResID = IDR_MAINFRAME; // Set values to be displayed in the view window m_view.m_dwCommCtrlMajor = dwMajor; m_view.m_dwCommCtrlMinor = dwMinor; m_view.m_bAlpha = (uResID == IDR_MAINFRAME); // create command bar window HWND hWndCmdBar = m_CmdBar.Create(m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE); // attach menu m_CmdBar.AttachMenu(GetMenu()); // load command bar images m_CmdBar.LoadImages(uResID); // remove old menu SetMenu(NULL); HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd, uResID, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE); CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE); AddSimpleReBarBand(hWndCmdBar); AddSimpleReBarBand(hWndToolBar, NULL, TRUE); CreateSimpleStatusBar(); _createVerticalSplitter(); _createCanvas(); _createHoricalSplitter(); _createTreeView(); _createAnimationBox(); UpdateLayout(); UIAddToolBar(hWndToolBar); UISetCheck(ID_VIEW_TOOLBAR, 1); UISetCheck(ID_VIEW_RENDER_BAR, 1); UISetCheck(ID_VIEW_STATUS_BAR, 1); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); UIEnable(ID_EDIT_PASTE, FALSE); _canvas = NULL; // return 0; }
void PreviousImagesView::DestroyView() { // remove idle handler CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != nullptr); pLoop->RemoveIdleHandler(this); ATLVERIFY(TRUE == DestroyWindow()); }
CSearchDlg::~CSearchDlg() { ATLTRACE(_T("CSearchDlg::~CSearchDlg()\n")); CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->RemoveMessageFilter(this); pLoop->RemoveIdleHandler(this); }
BOOL CDLListWindow::OnInitDialog(CWindow wndFocus, LPARAM lInitParam) { m_nDownloading = 0; WM_DLCOMPLETE = ::RegisterWindowMessage(REGISTERMESSAGE_DLCOMPLETE); DoDataExchange(DDX_LOAD); m_editDLFolder = m_cmbDLFolder.GetDlgItem(1001); // ダイアログリサイズ初期化 DlgResize_Init(true, true, WS_THICKFRAME | WS_CLIPCHILDREN); for (int i = 1; i <= 5; ++i) { CString str; str.Append(i); m_cmbParallelDL.AddString(str); } /* 設定を復元する */ CIniFileI pr(CDLOptions::s_DLIniFilePath, _T("DLList")); m_cmbParallelDL.SetCurSel(pr.GetValue(_T("ParallelDL"), 0)); CRect rcWindow; rcWindow.top = pr.GetValue(_T("top"), -1); rcWindow.left = pr.GetValue(_T("left"), -1); rcWindow.right = pr.GetValue(_T("right"), -1); rcWindow.bottom = pr.GetValue(_T("bottom"), -1); if (rcWindow != CRect(-1, -1, -1, -1)) MoveWindow(rcWindow); // 位置を復元 // リストビューを準備 m_DLList.InsertColumn(0, _T("URL")); m_DLList.SetColumnWidth(0, pr.GetValue(_T("ColumnWidthURL"), 300)); int nCount = (int)CDLOptions::s_vecImageDLFolderHistory.size(); for (int i = 0; i < nCount; ++i) { m_cmbDLFolder.AddString(CDLOptions::s_vecImageDLFolderHistory[i]); } // ImageDLFolderのパスに設定 m_cmbDLFolder.SetWindowText(CDLOptions::strImgDLFolderPath); m_cmbDLOption.AddString(_T("上書きの確認をする")); m_cmbDLOption.AddString(_T("上書きの確認をしない")); m_cmbDLOption.AddString(_T("連番を付ける")); m_cmbDLOption.SetCurSel(pr.GetValue(_T("DLOption"), 0)); RegisterDragDrop(); CMessageLoop *pLoop = _Module.GetMessageLoop(); pLoop->AddMessageFilter(this); return FALSE; }
LRESULT CMainDlg::OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // unregister message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->RemoveMessageFilter(this); pLoop->RemoveIdleHandler(this); return 0; }
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT) { CMessageLoop theLoop; _Module.AddMessageLoop(&theLoop); int nRet = theLoop.Run(); _Module.RemoveMessageLoop(); return nRet; }
LRESULT CSearchDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { BOOL bRet; // Initialize the CDialogResize DlgResize_Init(/*bAddGripper*/ true, /*bUseMinTrackSize*/ false); // center the dialog on the screen CenterWindow(); // Subclass the 'Cancel' button and attach it to the CButtonExCancel object bRet = m_wndBtnCancel.SubclassWindow(GetDlgItem(IDCANCEL)); ATLASSERT(bRet); // Subclass the 'Find' button and attach it to the CButtonExFind object bRet = m_wndBtnFind.SubclassWindow(GetDlgItem(IDC_FIND)); ATLASSERT(bRet); // Subclass the 'New Note' button and attach it to the CButtonExNew object bRet = m_wndBtnNew.SubclassWindow(GetDlgItem(IDC_NEW)); ATLASSERT(bRet); // Subclass the edit control and attach it to the CEditEx object bRet = m_wndSearchEdit.SubclassWindow(GetDlgItem(IDC_SEARCH_EDIT)); ATLASSERT(bRet); // Subclass the list control and attach it to the CSearchList object bRet = m_wndSearchList.SubclassWindow(GetDlgItem(IDC_SEARCH_LIST)); ATLASSERT(bRet); // Pass the pointer to the hidden window to the list control m_wndSearchList.SetPointerToHiddenWindow(m_pWndParent); // Subclass the 'Find Note' static control and attach it to the CLabel object bRet = m_wndLblFind.SubclassWindow(GetDlgItem(IDC_STATIC_FIND)); ATLASSERT(bRet); m_wndLblFind.SetFont3D(TRUE,CLabel::Raised) .SetText3DHiliteColor(RGB(0, 0, 255)) .SetFontName("Times New Roman") .SetFontSize(16) .SetFontBold(TRUE); // Subclass the 'Look for' static control and attach it to the CLabel object bRet = m_wndLblLookFor.SubclassWindow(GetDlgItem(IDC_STATIC_LOOK)); ATLASSERT(bRet); m_wndLblLookFor.SetFontSize(10); m_wndLblLookFor.SetFontBold(TRUE); // Register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); return TRUE; }
LRESULT CMainDlg::OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { beRunning = false; // unregister message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->RemoveMessageFilter(this); pLoop->RemoveIdleHandler(this); //::MessageBox(NULL, L"程序退出", L"Error", MB_OK); return 0; }