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); // 托盘图标 trayIcon.Create(this, (sysCn) ? IDR_TRAYPOPUPCN : IDR_TRAYPOPUPEN, GetLocalWStr(strTrayOpenMainForm), //L"打开主界面", GetLocalWStr(strTrayTaiyiStarting), //L"太一运行中...", L"", 1, CTrayNotifyIcon::None, hIcon, WM_TRAYNOTIFY, 0, TRUE, FALSE, FALSE, NULL, FALSE, TRUE); // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); UIAddChildWindowContainer(m_hWnd); // 设置时钟,检测服务线程退出 SetTimer(1, 100); SetTimer(2, 10000); SetMsgHandled(false); return TRUE; }
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); //读配置必须在最开始 ReadSysIni(); InitControl(); SetButtonIco(); UpdateExe(); return TRUE; }
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); SetDlgItemText(IDC_EDT_SOURCE, _T("c:\\audio\\ave_maria.wav")); SetDlgItemText(IDC_EDT_DEST, _T("f:\\temp\\im\\ave_maria.aac")); return TRUE; }
LRESULT CFeedbackDialog::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); SetWindowText(UNINSTALL_TITLE); //窗口位置、尺寸和圆角 int w = FEEDBACK_DLG_SIZE_W + 1; int h = FEEDBACK_DLG_SIZE_H + 1; //设置窗口大小 by zy SetWindowPos(HWND_TOP, m_WndX, m_WndY, w, h, NULL); //HRGN hrgn = CreateRoundRectRgn(0, 0, w, h, 5, 5);// rounded rect w/50 pixel corners //SetWindowRgn(hrgn, TRUE); m_pDialogBkg = new CDialogBackground(m_hWnd); m_pDialogBkg->SetStatu(LS_Feedback); BindResControl(); SetForegroundWindow(m_hWnd); return 0; }
LRESULT [!output WTL_MAINDLG_CLASS]::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { m_toolTip.Create(m_hWnd); //{{WTLBUILDER_MEMBER_CREATION //}}WTLBUILDER_MEMBER_CREATION //{{WTLBUILDER_POST_CREATION //}}WTLBUILDER_POST_CREATION //{{WTLBUILDER_TABSTOP //}}WTLBUILDER_TABSTOP [!if WTL_COM_SERVER] _Module.Lock(); [!endif] // 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); return TRUE; }
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); TCHAR szPath[MAX_PATH] = {0}; GetModuleFileName(NULL, szPath, MAX_PATH); PathRemoveFileSpec(szPath); PathRemoveFileSpec(szPath); PathCombine(szPath, szPath, L"Res"); strLargeImage = szPath; strSmallImage = szPath; strLargeImage += L"\\LargeImages\\%d.bmp"; strSmallImage += L"\\SmallImages\\%d.bmp"; return TRUE; }
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 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; }
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); this->SetTimer(TIMER_LOG, 3000, NULL); char cfgpath[256] = { 0 }; GetModuleFileName(NULL, cfgpath, 256); PathRemoveFileSpec(cfgpath); gexedir = cfgpath; std::string cfgfilename = gexedir + "\\stksto.ini"; CIniFile inifile; if (!inifile.Load(cfgfilename)) { return FALSE; } std::string drvdllfile = inifile.GetKeyValue("stk", "drvdll"); stkdrv.load(drvdllfile.c_str()); gMysqlWriter.init(inifile); return TRUE; }
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); m_EditMsg.Attach(GetDlgItem(IDC_EDTMSG)); m_ListLog.Attach(GetDlgItem(IDC_LISTLOG)); m_EditMsg.SetWindowText(TEXT("在此输入消息...")); pipe_driver_ = new CPipeDriver; pipe_handler_ = new MyPipeMessageHandler(&m_ListLog); return TRUE; }
BOOL CGroupInfoDlg::OnInitDialog(CWindow wndFocus, LPARAM lInitParam) { SetWindowPos(NULL, 0, 0, 400, 470, SWP_NOMOVE); CenterWindow(); // set icons m_hDlgIcon = AtlLoadIconImage(IDR_MAINFRAME, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON)); SetIcon(m_hDlgIcon, TRUE); m_hDlgSmallIcon = AtlLoadIconImage(IDR_MAINFRAME, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON)); SetIcon(m_hDlgSmallIcon, FALSE); Init(); // 初始化 CGroupInfo * lpGroupInfo = GetGroupInfoPtr(); if (lpGroupInfo != NULL) { if (!lpGroupInfo->IsHasGroupInfo()) m_lpQQClient->UpdateGroupInfo(m_nGroupCode); if (!lpGroupInfo->IsHasGroupNumber()) m_lpQQClient->UpdateGroupNum(m_nGroupCode); CString strTitle; strTitle.Format(_T("群设置 - %s"), lpGroupInfo->m_strName.c_str()); m_SkinDlg.SetTitleText(strTitle); } UpdateCtrls(); return TRUE; }
LRESULT [!output WTL_MAINDLG_CLASS]::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { m_toolTip.Create(m_hWnd); //{{WTLBUILDER_MEMBER_CREATION //}}WTLBUILDER_MEMBER_CREATION //{{WTLBUILDER_POST_CREATION //}}WTLBUILDER_POST_CREATION //{{WTLBUILDER_TABSTOP //}}WTLBUILDER_TABSTOP // 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); return TRUE; }
BOOL CBuddyInfoDlg::OnInitDialog(CWindow wndFocus, LPARAM lInitParam) { SetWindowPos(NULL, 0, 0, 580, 480, SWP_NOMOVE); CenterWindow(); // set icons m_hDlgIcon = AtlLoadIconImage(IDR_MAINFRAME, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON)); SetIcon(m_hDlgIcon, TRUE); m_hDlgSmallIcon = AtlLoadIconImage(IDR_MAINFRAME, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON)); SetIcon(m_hDlgSmallIcon, FALSE); Init(); // 初始化 CBuddyInfo * lpBuddyInfo = GetBuddyInfoPtr(); if (NULL == lpBuddyInfo) return TRUE; CString strTitle; if (m_bIsGMember || lpBuddyInfo->m_strMarkName.empty()) strTitle.Format(_T("%s的资料"), lpBuddyInfo->m_strNickName.c_str()); else strTitle.Format(_T("%s的资料"), lpBuddyInfo->m_strMarkName.c_str()); m_SkinDlg.SetTitleText(strTitle); if (m_lpQQClient != NULL) { if (!lpBuddyInfo->IsHasBuddyInfo()) { if (!m_bIsGMember) m_lpQQClient->UpdateBuddyInfo(m_nQQUin); else m_lpQQClient->UpdateGroupMemberInfo(m_nGroupCode, m_nQQUin); } if (!lpBuddyInfo->IsHasQQNum()) { if (!m_bIsGMember) m_lpQQClient->UpdateBuddyNum(m_nQQUin); else m_lpQQClient->UpdateGroupMemberNum(m_nGroupCode, m_nQQUin); } if (!lpBuddyInfo->IsHasQQSign()) { if (!m_bIsGMember) m_lpQQClient->UpdateBuddySign(m_nQQUin); else m_lpQQClient->UpdateGroupMemberSign(m_nGroupCode, m_nQQUin); } } UpdateCtrls(); return TRUE; }
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); return TRUE; }
BOOL FilterDialog::OnInitDialog(CWindow wndFocus, LPARAM lInitParam) { CenterWindow(); auto hIcon = AtlLoadIconImage(IDR_MAINFRAME, LR_DEFAULTCOLOR, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON)); SetIcon(hIcon, TRUE); auto hIconSmall = AtlLoadIconImage(IDR_MAINFRAME, LR_DEFAULTCOLOR, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON)); SetIcon(hIconSmall, FALSE); checkBoxClassSchema_ = GetDlgItem(IDC_CHECK1); checkBoxAttributeSchema_ = GetDlgItem(IDC_CHECK2); checkBoxSubSchema_ = GetDlgItem(IDC_CHECK3); checkBoxDisplaySpecifier_ = GetDlgItem(IDC_CHECK4); checkBoxOthers_ = GetDlgItem(IDC_CHECK5); checkBoxClassSchema_.SetCheck(BST_CHECKED); checkBoxAttributeSchema_.SetCheck(BST_CHECKED); checkBoxSubSchema_.SetCheck(BST_CHECKED); checkBoxDisplaySpecifier_.SetCheck(BST_CHECKED); checkBoxOthers_.SetCheck(BST_CHECKED); return TRUE; }
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); // 背景图片 _ctrlBg.Attach(GetDlgItem(IDC_BG)); _ctrlBg.SetBitmap(::LoadBitmap(_Module.m_hInstResource, MAKEINTRESOURCE((GetUserDefaultLangID() == 0x0804) ? IDB_BGCN : IDB_BGEN))); // 按钮初始化 _ctrlBnExit.Attach(GetDlgItem(IDBN_EXIT)); /// _ctrlBnExit.SetWindowText(L"退出并访问太一官网"); _ctrlBnExit.SetWindowText(GetLocalWStr(strExitAndOpenSite)); _ctrlBnExit.ShowWindow(FALSE); _ctrlBnRetry.Attach(GetDlgItem(IDBN_RETRY)); // _ctrlBnRetry.SetWindowText(L"重试"); _ctrlBnRetry.SetWindowText(GetLocalWStr(strRetry)); _ctrlBnRetry.ShowWindow(FALSE); _ctrlBnSkipWarn.Attach(GetDlgItem(IDBN_SKIP)); _ctrlBnSkipWarn.SetWindowText(GetLocalWStr(strSkipWarn)); _ctrlBnSkipWarn.ShowWindow(FALSE); // 消息提示 _ctrlStatic.Attach(GetDlgItem(IDC_MSG)); // 进度条 _ctrlProgress.Attach(GetDlgItem(IDC_PROGRESS1)); _ctrlProgress.ShowWindow(FALSE); ReStartWork(); return TRUE; }
LRESULT CMainDlg::OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { if (wParam == kIconTimerID) { static int index = 0; if (index == 0) { HICON hIcon = AtlLoadIconImage(IDI_ICON_WINDOW8, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON)); SetIcon(hIcon, TRUE); HICON hIconSmall = AtlLoadIconImage(IDI_ICON_WINDOW8, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON)); SetIcon(hIconSmall, FALSE); index = 1; } else { 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); index = 0; } } else if (wParam == kTimerID) { POINT pt; GetCursorPos(&pt); // if no movement, do not refresh the ui. if (pt.x == point_.x && pt.y == point_.y) return 0; point_.x = pt.x; point_.y = pt.y; // Basic Information GetBasicInfo(); // Advanced Information GetAdvancedInfo(); } 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); SetWindowLong(GWL_EXSTYLE, WS_EX_TOPMOST | WS_EX_LAYERED); SetLayeredWindowAttributes(m_hWnd, RGB(255, 0, 255), 220, LWA_COLORKEY | LWA_ALPHA); RECT rect; GetWindowRect(&rect); int w = rect.right - rect.left; int h = rect.bottom - rect.top; ::GetWindowRect(GetDesktopWindow(), &rect); int width = rect.right - rect.left; // GetSystemMetrics(SM_CXFULLSCREEN); int height = rect.bottom - rect.top; // GetSystemMetrics(SM_CYFULLSCREEN); height -= 40; // taskbar height SetWindowPos(HWND_TOPMOST, width - w, height - h, w, h, SWP_SHOWWINDOW); SetTimer(kTimerID, kTimerInterval, 0); SetTimer(kIconTimerID, kIconTimerInterval, 0); return TRUE; }
LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // 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); // center the main window on the screen CenterWindow(); m_hWndClient = m_dlg.Create(m_hWnd); // get required size of dialog RECT dlgRect; m_dlg.GetWindowRect(&dlgRect); // get size of current client rect for dialog RECT clientRect; GetClientRect(&clientRect); // get size of main frame RECT mainRect; GetWindowRect(&mainRect); m_minWidth = mainRect.right - mainRect.left + (dlgRect.right - dlgRect.left) - (clientRect.right - clientRect.left); m_minHeight = mainRect.bottom - mainRect.top + (dlgRect.bottom - dlgRect.top) - (clientRect.bottom - clientRect.top); // resize main frame if ((m_minWidth > mainRect.right - mainRect.left) || (m_minHeight > mainRect.bottom - mainRect.top)) { int x = MAX(m_minHeight, mainRect.right - mainRect.left); int y = MAX(m_minHeight, mainRect.bottom - mainRect.top); //SetWindowPos(NULL, 0, 0, x, y, SWP_NOMOVE | SWP_NOACTIVATE); } // register object for message filtering and idle updates CMessageLoop* pLoop = _Module.GetMessageLoop(); ATLASSERT(pLoop != NULL); pLoop->AddMessageFilter(this); pLoop->AddIdleHandler(this); return 0; }
LRESULT CMainDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // 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); initValue(); LoadSetting(); InitDB(); initPreviewDlg(); initDH(); initBottomButton(); initTimeLabel(); initSlide(); initCradleButton(); //默认选中channel 0 FocusChannel(0); //默认布局 SetPreviewDlgLayout(PREVIEWLAYOUT4,0); //计时器 时钟 SetTimer(1,1000); //录像 SetTimer(2,1000); SetWindowPos(NULL,0,0,1000,700,SWP_SHOWWINDOW); CenterWindow(); RegisterStreamDirectReadCallback(StreamDirectReadCallback, this); updateSetting(); return TRUE; }
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); //SendMessage(::GetDlgItem(m_hWnd, IDC_COMBO_TYPE), CB_RESETCONTENT, 0, 0); //SendMessage(::GetDlgItem(m_hWnd, IDC_COMBO_TYPE), CB_SETCURSEL, 0, 1); return TRUE; }
LRESULT CMainFrame::OnCreate(LPCREATESTRUCT lParam) { NdasUiDbgCall( 2, _T("m_hWnd = %p\n"), m_hWnd ); m_AutoPnpMutex = CreateSemaphore( NULL, 1, 1, NULL ); if (m_AutoPnpMutex == NULL) { ATLASSERT(m_AutoPnpMutex); } else { for (UINT i=0; i<NDAS_MAX_AUTO_PNP; i++) { m_NdasStringId[i] = (PTCHAR)::HeapAlloc( ::GetProcessHeap(), HEAP_ZERO_MEMORY, (NDAS_DEVICE_STRING_ID_LEN + 1) * sizeof(TCHAR) ); if (m_NdasStringId[i] == NULL) { ATLASSERT(FALSE); } } m_NdasStringIdLen = 0; } xTaskDialogInitialize(); #ifdef NDASMGMT_USE_QUERYCANCELAUTOPLAY WM_QUERYCANCELAUTOPLAY = ::RegisterWindowMessage(_T("QueryCancelAutoplay")); ATLASSERT(WM_QUERYCANCELAUTOPLAY); #endif int cxSmall = ::GetSystemMetrics(SM_CXSMICON); int cySmall = ::GetSystemMetrics(SM_CYSMICON); int cxLarge = ::GetSystemMetrics(SM_CXICON); int cyLarge = ::GetSystemMetrics(SM_CYICON); HICON hAppIcon = AtlLoadIconImage( IDR_MAINFRAME, LR_DEFAULTCOLOR | LR_DEFAULTSIZE, cxLarge, cyLarge); HICON hAppIconSmall = AtlLoadIconImage( IDR_MAINFRAME, LR_DEFAULTCOLOR | LR_DEFAULTSIZE, cxSmall, cySmall); ATLASSERT(hAppIcon && hAppIconSmall); SetIcon(hAppIcon, TRUE); SetIcon(hAppIconSmall, FALSE); m_hTaskbarDefaultMenu.LoadMenu(IDR_TASKBAR); m_taskbarIcon.Install(m_hWnd, 1, IDR_TASKBAR); // Create Task Bar Icon Image List // Only shell 6.0 or later can handle ILC_COLOR32 DWORD imageListFlags = ILC_MASK; imageListFlags |= (GetShellVersion() >= PackVersion(6,0)) ? ILC_COLOR32 : ILC_COLOR8; ATLVERIFY(m_taskbarImageList.Create(cxSmall, cySmall, imageListFlags , 2, 1)); ATLVERIFY(m_hTaskbarIconBase = AtlLoadIconImage(IDR_TASKBAR, LR_DEFAULTCOLOR, cxSmall, cySmall)); ATLVERIFY(m_hTaskbarFailOverlay = AtlLoadIconImage(IDR_TASKBAR_FAIL, LR_DEFAULTCOLOR, cxSmall, cySmall)); m_nTaskbarNormal = m_taskbarImageList.AddIcon(m_hTaskbarIconBase); m_nTaskbarFailureOverlay = m_taskbarImageList.AddIcon(m_hTaskbarFailOverlay); ATLVERIFY(m_taskbarImageList.SetOverlayImage(m_nTaskbarFailureOverlay, 1)); pUpdateDeviceList(); pUpdateMenuItems(); if (pGetAppConfigBOOL(_T("UseHotKey"), FALSE)) { NDASMGMT_POPUP_HOTKEY = ::GlobalAddAtom(ndasmgmt::NDASMGMT_ATOM_HOTKEY); ATLASSERT(NDASMGMT_POPUP_HOTKEY >= 0xC000 && NDASMGMT_POPUP_HOTKEY <= 0xFFFF); BOOL fSuccess = ::RegisterHotKey( m_hWnd, NDASMGMT_POPUP_HOTKEY, MOD_WIN, 'N' /* VK_N */); if (fSuccess) { m_fHotKeyRegistered = TRUE; } else { ATLVERIFY(0 == ::GlobalDeleteAtom(static_cast<ATOM>(NDASMGMT_POPUP_HOTKEY))); NDASMGMT_POPUP_HOTKEY = 0xFFFF; } } if (pGetAppConfigBOOL(_T("FirstRun"), TRUE)) { pShowWelcome(); ATLVERIFY(pSetAppConfigValueBOOL(_T("FirstRun"), FALSE)); } m_taskbarMenu.Init(m_hWnd); ATLVERIFY(m_bitmapHandler.Initialize()); // Subscribe NDAS Event ATLVERIFY(NdasEventSubscribe(m_hWnd)); NdasUiDbgCall( 2, "out\n" ); return 0; }
LRESULT CConfigDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // // Center dialog // 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); // // Profile path // { BOOL bSuccess = SetDlgItemText(IDC_PROFILE_PATH, m_strProfilePath); ATLASSERT(bSuccess); } // // Tracker port // { BOOL bSuccess = SetDlgItemInt(IDC_TRACKER_PORT, m_nTrackerPort, FALSE); ATLASSERT(bSuccess); // Limit input to 5 digits SendDlgItemMessage(IDC_TRACKER_PORT, EM_LIMITTEXT, 5, 0); } // // Display port // { BOOL bSuccess = SetDlgItemInt(IDC_CAPTURE_PORT, m_nDisplayPort, FALSE); ATLASSERT(bSuccess); // Limit input to 5 digits SendDlgItemMessage(IDC_CAPTURE_PORT, EM_LIMITTEXT, 5, 0); } // // Compression level // { BOOL bSuccess = SetDlgItemInt(IDC_COMPRESSION_LVL, m_nCompressionLvl, FALSE); ATLASSERT(bSuccess); // Limit input to 3 digits SendDlgItemMessage(IDC_COMPRESSION_LVL, EM_LIMITTEXT, 3, 0); } return TRUE; }
LRESULT CChooseUninstallDialog::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/){ 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); SetWindowText(UNINSTALL_TITLE); int w = BACKGROUND_SIZE_W + 1; int h = BACKGROUND_SIZE_HIDE_H + 1; SetWindowPos(HWND_TOP, 0, 0, w, h, SWP_NOMOVE); background_ = new CDialogBackground(m_hWnd); background_->SetStatu(LS_ChooseUninstall); //关闭按钮 close_image_button_ = CreateImageButton( IDB_PNG_CLOSE_NORMAL , IDB_PNG_CLOSE_HOVER , IDB_PNG_CLOSE_DOWN , IDB_PNG_CLOSE_NORMAL , GetDlgItem(IDC_BUTTON_CLOSE)); int close_button_h_interval = 10; int close_button_v_interval = 4; close_image_button_->SetWindowPos(HWND_TOP, w - close_button_h_interval - UNINSTALL_CLOSE_BTN_SIZE_W, close_button_v_interval, UNINSTALL_CLOSE_BTN_SIZE_W, UNINSTALL_CLOSE_BTN_SIZE_H, SWP_SHOWWINDOW); close_image_button_->SetBkgInfo(m_hWnd, background_->GetHDC()); //建议按钮 advice_button_ = CreateImageButton( IDB_PNG_ADVICE , IDB_PNG_ADVICE_HOVER , IDB_PNG_ADVICE_PRESSED , IDB_PNG_ADVICE , GetDlgItem(IDC_BUTTON_ADVICE)); int advice_button_h_interval = 124; int advice_button_v_interval = 46; int button_y = h - advice_button_v_interval - FEEDBACK_BTN_SIZE_H; advice_button_->SetWindowPos(HWND_BOTTOM , w - advice_button_h_interval - FEEDBACK_BTN_SIZE_W , button_y , FEEDBACK_BTN_SIZE_W , FEEDBACK_BTN_SIZE_H , NULL); advice_button_->SetBkgInfo(m_hWnd, background_->GetHDC()); //保留按钮 hold_yyexplore_button_ = CreateImageButton( IDB_PNG_HOLD_YYEXPLORE , IDB_PNG_HOLD_YYEXPLORE_HOVER , IDB_PNG_HOLD_YYEXPLORE_PRESSED , IDB_PNG_HOLD_YYEXPLORE , GetDlgItem(IDC_BUTTON_HOLD_EXPLORE)); hold_yyexplore_button_->SetWindowPos(HWND_TOP , advice_button_h_interval , button_y , FEEDBACK_BTN_SIZE_W , FEEDBACK_BTN_SIZE_H , SWP_SHOWWINDOW); hold_yyexplore_button_->SetBkgInfo(m_hWnd, background_->GetHDC()); int uninstall_button_interval = 10; uninstall_button_ = new CImageHandCursor(IDB_PNG_LINK_BG, IDB_PNG_LINK_BG, IDB_PNG_LINK_BG, IDB_PNG_LINK_BG); uninstall_button_->SubclassWindow(GetDlgItem(IDC_CHOOSE_BUTTON_UNINSTALL)); uninstall_button_->SetBkgInfo(m_hWnd, background_->GetHDC()); uninstall_button_->SetBtnTextColor(RGB(0x33, 0x99, 0xff)); HFONT m_hfont = ::CreateFont(14, 0, 0, 0, FW_NORMAL, 0, true, 0, DEFAULT_CHARSET, 0, 0, 0, 0, L""); uninstall_button_->SetFont(m_hfont); int uninstall_button_width = 80; int uninstall_button_height = 15; uninstall_button_->SetWindowPos(HWND_TOP , w - advice_button_h_interval - uninstall_button_width , button_y + FEEDBACK_BTN_SIZE_H + uninstall_button_interval , uninstall_button_width , uninstall_button_height , SWP_SHOWWINDOW); BindControl(); return true; }
LRESULT CMainFrame::OnCreate(LPCREATESTRUCT lParam) { #ifdef NDASMGMT_USE_QUERYCANCELAUTOPLAY WM_QUERYCANCELAUTOPLAY = ::RegisterWindowMessage(_T("QueryCancelAutoplay")); ATLASSERT(WM_QUERYCANCELAUTOPLAY); #endif int cxSmall = ::GetSystemMetrics(SM_CXSMICON); int cySmall = ::GetSystemMetrics(SM_CYSMICON); int cxLarge = ::GetSystemMetrics(SM_CXICON); int cyLarge = ::GetSystemMetrics(SM_CYICON); HICON hAppIcon = AtlLoadIconImage( IDR_MAINFRAME, LR_DEFAULTCOLOR | LR_DEFAULTSIZE, cxLarge, cyLarge); HICON hAppIconSmall = AtlLoadIconImage( IDR_MAINFRAME, LR_DEFAULTCOLOR | LR_DEFAULTSIZE, cxSmall, cySmall); ATLASSERT(hAppIcon && hAppIconSmall); SetIcon(hAppIcon, TRUE); SetIcon(hAppIconSmall, FALSE); m_hTaskbarDefaultMenu.LoadMenu(IDR_TASKBAR); m_taskbarIcon.Install(m_hWnd, 1, IDR_TASKBAR); // Create Task Bar Icon Image List // Only shell 6.0 or later can handle ILC_COLOR32 DWORD imageListFlags = ILC_MASK; imageListFlags |= (GetShellVersion() >= PackVersion(6,0)) ? ILC_COLOR32 : ILC_COLOR8; ATLVERIFY(m_taskbarImageList.Create(cxSmall, cySmall, imageListFlags , 2, 1)); ATLVERIFY(m_hTaskbarIconBase = AtlLoadIconImage(IDR_TASKBAR, LR_DEFAULTCOLOR, cxSmall, cySmall)); ATLVERIFY(m_hTaskbarFailOverlay = AtlLoadIconImage(IDR_TASKBAR_FAIL, LR_DEFAULTCOLOR, cxSmall, cySmall)); m_nTaskbarNormal = m_taskbarImageList.AddIcon(m_hTaskbarIconBase); m_nTaskbarFailureOverlay = m_taskbarImageList.AddIcon(m_hTaskbarFailOverlay); ATLVERIFY(m_taskbarImageList.SetOverlayImage(m_nTaskbarFailureOverlay, 1)); _UpdateDeviceList(); _UpdateMenuItems(); if (pGetAppConfigBOOL(_T("UseHotKey"), FALSE)) { NDASMGMT_POPUP_HOTKEY = ::GlobalAddAtom(ndasmgmt::NDASMGMT_ATOM_HOTKEY); ATLASSERT(NDASMGMT_POPUP_HOTKEY >= 0xC000 && NDASMGMT_POPUP_HOTKEY <= 0xFFFF); BOOL fSuccess = ::RegisterHotKey( m_hWnd, NDASMGMT_POPUP_HOTKEY, MOD_WIN, 'N' /* VK_N */); if (fSuccess) { m_fHotKeyRegistered = TRUE; } else { ATLVERIFY(0 == ::GlobalDeleteAtom(static_cast<ATOM>(NDASMGMT_POPUP_HOTKEY))); NDASMGMT_POPUP_HOTKEY = 0xFFFF; } } if (pGetAppConfigBOOL(_T("FirstRun"), TRUE)) { _ShowWelcome(); ATLVERIFY(pSetAppConfigValueBOOL(_T("FirstRun"), FALSE)); } ATLVERIFY(m_bitmapHandler.Initialize()); // Subscribe NDAS Event ATLVERIFY(NdasEventSubscribe(m_hWnd)); return 0; }