LRESULT CMainFrame::OnUpdateTab(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { HWND hwnd = (HWND)lParam; content::TAB_INFO ti = m_web_contents_delegate->GetTabInfo(hwnd); CButton button; button.Attach(hwnd); // 设置tab标题 button.SetWindowText(ti.title.c_str()); return 0; }
LRESULT CBindTypePage::OnInitDialog(HWND hWnd, LPARAM lParam) { UpdateControls(NMT_AGGREGATE); CButton btnDefault; btnDefault.Attach(GetDlgItem(IDC_BIND_TYPE_AGGR)); btnDefault.SetCheck(BST_CHECKED); // Let the dialog manager set the initial focus return 1; }
void zstringEx::showCtl(int CtlID,BOOL isshow,HWND ParentWindowHwnd) { HWND oh; if(ParentWindowHwnd==NULL) { CWnd *w=::AfxGetMainWnd(); oh=w->m_hWnd; } else oh=ParentWindowHwnd; CButton b; b.Attach(GetDlgItem(oh,CtlID)); if(isshow)b.ShowWindow(SW_SHOW);else b.ShowWindow(SW_HIDE); b.Detach(); }
void zstringEx::enableCtl(int CtlID,BOOL isenable,HWND ParentWindowHwnd) { HWND oh; if(ParentWindowHwnd==NULL) { CWnd *w=::AfxGetMainWnd(); oh=w->m_hWnd; } else oh=ParentWindowHwnd; CButton b; b.Attach(GetDlgItem(oh,CtlID)); b.EnableWindow(isenable); b.Detach(); }
void zstringEx::setCtlCheck(int CtlID,int ischeck,HWND ParentWindowHwnd) { HWND oh; if(ParentWindowHwnd==NULL) { CWnd *w=::AfxGetMainWnd(); oh=w->m_hWnd; } else oh=ParentWindowHwnd; CButton b; b.Attach(GetDlgItem(oh,CtlID)); b.SetCheck(ischeck); b.Detach(); }
int zstringEx::getCtlCheck(int CtlID,HWND ParentWindowHwnd) { HWND oh; if(ParentWindowHwnd==NULL) { CWnd *w=::AfxGetMainWnd(); oh=w->m_hWnd; } else oh=ParentWindowHwnd; CButton b; b.Attach(GetDlgItem(oh,CtlID)); int r=b.GetCheck(); b.Detach(); return r; }
LRESULT CBindTypePage::OnInitDialog(HWND hWnd, LPARAM lParam) { UpdateControls(NMT_AGGREGATE); CButton btnDefault; // // Check the default button // btnDefault.Attach(GetDlgItem(IDC_BIND_TYPE_AGGR)); btnDefault.SetCheck(BST_CHECKED); #ifdef _DISABLE_RAID4_RAID5_BTN_ON_BINDDLG_ // // Hide RAID4 button // CButton btnRaid4R; btnRaid4R.Attach(GetDlgItem(IDC_BIND_TYPE_RAID4)); btnRaid4R.EnableWindow(FALSE); btnRaid4R.ModifyStyle(WS_VISIBLE, 0, 0); CButton btnRaid5R; btnRaid5R.Attach(GetDlgItem(IDC_BIND_TYPE_RAID5)); btnRaid5R.EnableWindow(FALSE); btnRaid5R.ModifyStyle(WS_VISIBLE, 0, 0); #endif // Let the dialog manager set the initial focus return 1; }
void CDlgManager::UpdateUI() { CButton btn; SetButtons ( ); switch( m_ctrlState ) { case Control_Logon: ShowLoginInputs ( ); GetDlgItem(IDC_STATIC_COMMENT0)->ShowWindow( SW_SHOW ); GetDlgItem(IDC_STATIC_COMMENT1)->ShowWindow( SW_SHOW ); GetDlgItem(IDC_STATIC_COMMENT2)->ShowWindow( SW_SHOW ); GetDlgItem(IDC_STATIC_COMMENT3)->ShowWindow( SW_SHOW ); GetDlgItem(IDC_STATIC_COMMENT4)->ShowWindow( SW_SHOW ); // 下面的几行与Tab顺序有关, 所以不能随意执行动位置 //GetDlgItem(IDCANCEL)->SetWindowPos( &CWnd::wndTop, // 110, 302, 76, 22, SWP_FRAMECHANGED | SWP_SHOWWINDOW ); GetDlgItem(IDOK)->SetWindowPos( &CWnd::wndTop, 90, 232, 76, 22, SWP_FRAMECHANGED | SWP_SHOWWINDOW ); GetDlgItem(IDC_STATIC_COMMENT0)->SetWindowPos( &CWnd::wndTop, 10, 36, 245, 110, SWP_FRAMECHANGED | SWP_SHOWWINDOW ); GetDlgItem(IDC_STATIC_COMMENT1)->SetWindowPos( &CWnd::wndTop, 37, 72, 56, 20, SWP_FRAMECHANGED | SWP_SHOWWINDOW ); GetDlgItem(IDC_SERVERADDRESS)->SetWindowPos( &CWnd::wndTop, 98, 188, 136, 26, SWP_FRAMECHANGED | SWP_SHOWWINDOW ); GetDlgItem(IDC_PASSWARD)->SetWindowPos( &CWnd::wndTop, 98, 98, 136, 26, SWP_FRAMECHANGED | SWP_SHOWWINDOW ); GetDlgItem(IDC_USERNAME)->SetWindowPos( &CWnd::wndTop, 98, 68, 136, 26, SWP_FRAMECHANGED | SWP_SHOWWINDOW ); GetDlgItem(IDC_STATIC_COMMENT2)->SetWindowPos( &CWnd::wndTop, 37, 102, 56, 20, SWP_FRAMECHANGED | SWP_SHOWWINDOW ); GetDlgItem(IDC_STATIC_COMMENT3)->SetWindowPos( &CWnd::wndTop, 37, 165, 136, 20, SWP_FRAMECHANGED | SWP_SHOWWINDOW ); GetDlgItem(IDC_STATIC_COMMENT4)->SetWindowPos( &CWnd::wndTop, 37, 225, 136, 20, SWP_FRAMECHANGED | SWP_SHOWWINDOW ); GetDlgItem(IDC_PORT)->SetWindowPos( &CWnd::wndTop, 98, 248, 136, 26, SWP_FRAMECHANGED | SWP_SHOWWINDOW ); GetDlgItem(IDC_STATIC_MARKED) -> ShowWindow( SW_HIDE ); GetDlgItem(IDC_CURRENTNUM) -> ShowWindow( SW_HIDE ); GetDlgItem(IDC_STATIC_COMMENT0)->SetWindowText( _T("用户登陆信息") ); GetDlgItem(IDC_STATIC_COMMENT1)->SetWindowText( _T("帐号:") ); GetDlgItem(IDC_USERNAME)->SetWindowText( m_strUserName ); GetDlgItem(IDC_STATIC_COMMENT2)->SetWindowText( _T("密码:") ); GetDlgItem(IDC_PASSWARD)->SetWindowText( _T("") ); GetDlgItem(IDC_STATIC_COMMENT3)->SetWindowText( _T("服务器地址:") ); GetDlgItem(IDC_SERVERADDRESS)->SetWindowText( m_strServerAddress ); // GetDlgItem(IDC_STATIC_COMMENT4)->SetWindowText( _T(" 端口:") ); GetDlgItem(IDC_STATIC_COMMENT4)->SetWindowText( _T(" ") ); // GetDlgItem(IDC_PORT)->SetWindowText( _T(m_lPort) ); GetDlgItem(IDC_PORT)->ShowWindow( SW_HIDE ); GetDlgItem(IDOK)->SetWindowText( _T("登 陆") ); GetDlgItem(IDCANCEL)->SetWindowText( _T("取 消") ); btn.Attach(GetDlgItem(IDOK)->GetSafeHwnd()); btn.ModifyStyle(0,BS_DEFPUSHBUTTON); btn.Detach(); GetDlgItem(IDC_USERNAME) ->SetFocus(); ((CEdit*)GetDlgItem(IDC_USERNAME))->SetSel( 0, 10 ); break; case Control_Logon_Wait: ShowLoginInputs ( SW_HIDE ); GetDlgItem(IDC_CURRENTNUM) ->ShowWindow( SW_HIDE ); GetDlgItem(IDC_STATIC_COMMENT0)->ShowWindow( SW_HIDE ); GetDlgItem(IDC_STATIC_COMMENT2)->ShowWindow( SW_HIDE ); GetDlgItem(IDC_STATIC_COMMENT3)->ShowWindow( SW_HIDE ); GetDlgItem(IDC_STATIC_COMMENT4)->ShowWindow( SW_HIDE ); GetDlgItem(IDC_STATIC_COMMENT1)->ShowWindow( SW_SHOW ); GetDlgItem(IDC_STATIC_COMMENT1)->SetWindowText( _T("系统正在连接到服务器\r\n\r\n请稍候...") ); GetDlgItem(IDC_STATIC_COMMENT1)->SetWindowPos( &CWnd::wndTop, 37, 172, 180, 80, SWP_FRAMECHANGED | SWP_SHOWWINDOW ); break; case Control_Regist_Wait: GetDlgItem(IDC_STATIC_COMMENT1)->SetWindowText( _T("正在连接服务器!\r\n\r\n") ); GetDlgItem(IDC_STATIC_COMMENT1)->SetWindowPos( &CWnd::wndTop, 37, 62, 180, 80, SWP_FRAMECHANGED | SWP_SHOWWINDOW ); GetDlgItem(IDC_STATIC_COMMENT2)->ShowWindow( SW_SHOW ); GetDlgItem(IDC_STATIC_COMMENT2)->SetWindowText( _T("系统开始登陆到服务器\r\n\r\n请稍候...") ); GetDlgItem(IDC_STATIC_COMMENT2)->SetWindowPos( &CWnd::wndTop, 37, 162, 180, 80, SWP_FRAMECHANGED | SWP_SHOWWINDOW ); break; case Control_Head_Registed: // 组长登陆服务器成功后 ShowLoginInputs ( SW_HIDE ); //Set comments GetDlgItem(IDC_STATIC_COMMENT1)-> SetWindowPos( &CWnd::wndTop, 10, 42, 260, 18, SWP_FRAMECHANGED | SWP_SHOWWINDOW ); { int height = 70; GetDlgItem(IDC_STATIC_COMMENT0)-> SetWindowPos( &CWnd::wndTop, 5, TOPLINE-50, 240, height, SWP_FRAMECHANGED | SWP_SHOWWINDOW); } GetDlgItem(IDC_STATIC_COMMENT2)-> SetWindowPos( &CWnd::wndTop, 116, TOPLINE-28, 66, 16, SWP_FRAMECHANGED | SWP_SHOWWINDOW); GetDlgItem(IDC_STATIC_COMMENT3)-> SetWindowPos( &CWnd::wndTop, 202, TOPLINE-28, 34, 16, SWP_FRAMECHANGED | SWP_SHOWWINDOW); GetDlgItem(IDC_STATIC_COMMENT4)-> SetWindowPos( &CWnd::wndTop, 102, 12, 88, 24, SWP_FRAMECHANGED | SWP_SHOWWINDOW); GetDlgItem(IDC_STATIC_COMMENT0)-> SetWindowText(_T("comment0")); GetDlgItem(IDC_STATIC_COMMENT2)-> SetWindowText(_T("comment2")); GetDlgItem(IDC_STATIC_COMMENT3)-> SetWindowText(_T("comment3")); GetDlgItem(IDC_STATIC_COMMENT4)-> SetWindowText(_T("comment4")); { CString strText; strText.Format( "当前用户comment1:%s", m_strNickname ); GetDlgItem(IDC_STATIC_COMMENT1)-> SetWindowText( strText ); } //Set buttons //{ // int yposition; // GetDlgItem(IDC_MODIFY) -> SetWindowPos( &CWnd::wndTop, // 6,yposition+50,80,42, SWP_FRAMECHANGED | SWP_SHOWWINDOW); //} GetDlgItem(ID_HIDEDLG_OR_NOT) -> ShowWindow( SW_HIDE ); break; case Control_Regist_Done: // 登陆服务器完全成功 ShowLoginInputs ( SW_HIDE ); //Set comments GetDlgItem(IDC_STATIC_COMMENT1)-> SetWindowPos( &CWnd::wndTop, 10, 42, 260, 18, SWP_FRAMECHANGED | SWP_SHOWWINDOW ); { int height = 70; GetDlgItem(IDC_STATIC_COMMENT0)-> SetWindowPos( &CWnd::wndTop, 5, TOPLINE-50, 240, height, SWP_FRAMECHANGED | SWP_SHOWWINDOW); } GetDlgItem(IDC_STATIC_COMMENT2)-> SetWindowPos( &CWnd::wndTop, 116, TOPLINE-28, 66, 16, SWP_FRAMECHANGED | SWP_SHOWWINDOW); GetDlgItem(IDC_STATIC_COMMENT3)-> SetWindowPos( &CWnd::wndTop, 202, TOPLINE-28, 34, 16, SWP_FRAMECHANGED | SWP_SHOWWINDOW); GetDlgItem(IDC_STATIC_COMMENT4)-> SetWindowPos( &CWnd::wndTop, 102, 12, 88, 24, SWP_FRAMECHANGED | SWP_SHOWWINDOW); GetDlgItem(ID_HIDEDLG_OR_NOT) -> ShowWindow( SW_HIDE ); break; // /01/17 case Control_Processing://打印job ShowLoginInputs ( SW_HIDE ); //Set comments GetDlgItem(IDC_STATIC_COMMENT1)-> SetWindowPos( &CWnd::wndTop, 10, 42, 260, 18, SWP_FRAMECHANGED | SWP_SHOWWINDOW ); { int height = 70; GetDlgItem(IDC_STATIC_COMMENT0)-> SetWindowPos( &CWnd::wndTop, 5, TOPLINE-50, 240, height, SWP_FRAMECHANGED | SWP_SHOWWINDOW); } GetDlgItem(IDC_STATIC_COMMENT2)-> SetWindowPos( &CWnd::wndTop, 116, TOPLINE-28, 66, 16, SWP_FRAMECHANGED | SWP_SHOWWINDOW); GetDlgItem(IDC_STATIC_COMMENT3)-> SetWindowPos( &CWnd::wndTop, 202, TOPLINE-28, 34, 16, SWP_FRAMECHANGED | SWP_SHOWWINDOW); GetDlgItem(IDC_STATIC_COMMENT4)-> SetWindowPos( &CWnd::wndTop, 102, 12, 88, 24, SWP_FRAMECHANGED | SWP_SHOWWINDOW); break; // /01/17 case Control_Selecting://打印job ShowLoginInputs ( SW_HIDE ); //Set comments GetDlgItem(IDC_STATIC_COMMENT1)-> SetWindowPos( &CWnd::wndTop, 10, 42, 260, 18, SWP_FRAMECHANGED | SWP_SHOWWINDOW ); { int height = 70; GetDlgItem(IDC_STATIC_COMMENT0)-> SetWindowPos( &CWnd::wndTop, 5, TOPLINE-50, 240, height, SWP_FRAMECHANGED | SWP_SHOWWINDOW); } GetDlgItem(IDC_STATIC_COMMENT2)-> SetWindowPos( &CWnd::wndTop, 116, TOPLINE-28, 66, 16, SWP_FRAMECHANGED | SWP_SHOWWINDOW); GetDlgItem(IDC_STATIC_COMMENT3)-> SetWindowPos( &CWnd::wndTop, 202, TOPLINE-28, 34, 16, SWP_FRAMECHANGED | SWP_SHOWWINDOW); GetDlgItem(IDC_STATIC_COMMENT4)-> SetWindowPos( &CWnd::wndTop, 102, 12, 88, 24, SWP_FRAMECHANGED | SWP_SHOWWINDOW); break; case Control_Reprocessing://重新打印job ShowLoginInputs ( SW_HIDE ); //Set comments GetDlgItem(IDC_STATIC_COMMENT1)-> SetWindowPos( &CWnd::wndTop, 10, 42, 260, 18, SWP_FRAMECHANGED | SWP_SHOWWINDOW ); { int height = 70; GetDlgItem(IDC_STATIC_COMMENT0)-> SetWindowPos( &CWnd::wndTop, 5, 126, 240, height, SWP_FRAMECHANGED | SWP_SHOWWINDOW); } break; case Control_Marked: //task已经修执行过 ShowLoginInputs ( SW_HIDE ); //Set comments GetDlgItem(IDC_STATIC_COMMENT1)-> SetWindowPos( &CWnd::wndTop, 10, 42, 260, 18, SWP_FRAMECHANGED | SWP_SHOWWINDOW ); { int height = 70; GetDlgItem(IDC_STATIC_COMMENT0)-> SetWindowPos( &CWnd::wndTop, 5, TOPLINE-50, 240, height, SWP_FRAMECHANGED | SWP_SHOWWINDOW); } GetDlgItem(IDC_STATIC_COMMENT2)-> SetWindowPos( &CWnd::wndTop, 116, TOPLINE-28, 66, 16, SWP_FRAMECHANGED | SWP_SHOWWINDOW); GetDlgItem(IDC_STATIC_COMMENT3)-> SetWindowPos( &CWnd::wndTop, 202, TOPLINE-28, 34, 16, SWP_FRAMECHANGED | SWP_SHOWWINDOW); GetDlgItem(IDC_STATIC_COMMENT4)-> SetWindowPos( &CWnd::wndTop, 102, 12, 88, 24, SWP_FRAMECHANGED | SWP_SHOWWINDOW); break; case Control_All_Done://所有工作都已完成 GetDlgItem(IDC_STATIC_COMMENT0)->ShowWindow( SW_HIDE ); GetDlgItem(IDC_STATIC_COMMENT3)->ShowWindow( SW_HIDE ); GetDlgItem(IDC_STATIC_COMMENT4)->ShowWindow( SW_HIDE ); ShowLoginInputs ( SW_HIDE ); GetDlgItem(IDC_STATIC_COMMENT1)->SetWindowText( _T("成功登出!\r\n\r\n") ); GetDlgItem(IDC_STATIC_COMMENT1)->SetWindowPos( &CWnd::wndTop, 37, 122, 180, 30, SWP_FRAMECHANGED | SWP_SHOWWINDOW ); GetDlgItem(IDC_STATIC_COMMENT2)->ShowWindow( SW_SHOW ); GetDlgItem(IDC_STATIC_COMMENT2)->SetWindowText( _T("全部完成!\r\n\r\n请关闭程序") ); GetDlgItem(IDC_STATIC_COMMENT2)->SetWindowPos( &CWnd::wndTop, 37, 182, 180, 80, SWP_FRAMECHANGED | SWP_SHOWWINDOW ); break; case Control_Channel_Done://所有task都做完了 ShowLoginInputs ( SW_HIDE ); GetDlgItem(IDC_STATIC_COMMENT0)->ShowWindow( SW_HIDE ); GetDlgItem(IDC_STATIC_COMMENT3)->ShowWindow( SW_HIDE ); GetDlgItem(IDC_STATIC_COMMENT4)->ShowWindow( SW_HIDE ); GetDlgItem(IDC_STATIC_COMMENT1)->SetWindowText( _T("成功登出!\r\n\r\n") ); GetDlgItem(IDC_STATIC_COMMENT1)->SetWindowPos( &CWnd::wndTop, 37, 122, 180, 30, SWP_FRAMECHANGED | SWP_SHOWWINDOW ); GetDlgItem(IDC_STATIC_COMMENT2)->ShowWindow( SW_SHOW ); GetDlgItem(IDC_STATIC_COMMENT2)->SetWindowText( _T("\r\n\r\n请关闭程序") ); GetDlgItem(IDC_STATIC_COMMENT2)->SetWindowPos( &CWnd::wndTop, 37, 182, 200, 150, SWP_FRAMECHANGED | SWP_SHOWWINDOW ); break; default: break; } RedrawWindow(); }