BOOL CSplashDlg::Create( CWnd* pParentWnd, int nShowTime, LPCTSTR lpszUser, LPCTSTR lpszRegCode, LPCTSTR lpszVersionString, BOOL bAutoDelete, int nMin, int nMax ) { if( ! CXFResDialog::Create( CSplashDlg::IDD, pParentWnd) ) { ASSERT( FALSE ); return FALSE; } ModifyStyleEx( 0, WS_EX_TOOLWINDOW ); //ModifyStyleEx( 0, WS_EX_TRANSPARENT ); if( nShowTime > 0 ) SetTimer( 1, nShowTime, NULL ); CString strVersion = lpszVersionString; if( strVersion.GetLength() > 0 ) m_staticVersion.SetWindowText( strVersion ); CString strUser; if( NULL != lpszUser ) strUser = lpszUser; if( strUser.IsEmpty() ) strUser = AfxModuleLoadString( IDS_XFAUTHORIZEDUSER_UNKNOWN ); m_staticUser.SetWindowText( strUser ); CString strRegCode; if( NULL != lpszRegCode ) strRegCode = lpszRegCode; if( strRegCode.IsEmpty() ) strRegCode = AfxModuleLoadString( IDS_XFREGCODE_UNPURCHASED ); m_staticRegCode.SetWindowText( strRegCode ); m_bAutoDelete = bAutoDelete; SetProgressRange( nMin, nMax ); return TRUE; }
void CStartupDlg::OnDelete() { int nSel = m_comboServer.GetCurSel(); if( CB_ERR == nSel ) { AfxMessageBox( AfxModuleLoadString(IDS_SELECTSRV_NOSELECTED) ); return; } if( IDYES != AfxMessageBox( AfxModuleLoadString(IDS_SELECTSRV_DELCONFIRM), MB_YESNO ) ) return; int i = m_comboServer.GetItemData(nSel); CQuoteServerArray & aServers = AfxGetQSProfile().GetQuoteServers(); if( i >= 0 && i < aServers.GetSize() ) { aServers.RemoveAt(i); AfxGetQSProfile().SetCurrentServer(i); } SetupComboServer( ); OnSelchangeComboServer( ); AfxGetQSProfile().StoreProfile(); }
void CStartupDlg::OnModify() { CQuoteServer qs; int nSel = m_comboServer.GetCurSel(); if( CB_ERR == nSel ) { AfxMessageBox( AfxModuleLoadString(IDS_SELECTSRV_NOSELECTED) ); return; } int i = m_comboServer.GetItemData(nSel); CQuoteServerArray & aServers = AfxGetQSProfile().GetQuoteServers(); if( i >= 0 && i < aServers.GetSize() ) qs = aServers.ElementAt(i); CEditSrvDlg dlg; dlg.SetQuoteServer( qs ); if( IDOK == dlg.DoModal() ) { dlg.GetQuoteServer( qs ); if( i >= 0 && i < aServers.GetSize() ) { aServers.SetAt(i,qs); AfxGetQSProfile().SetCurrentServer(i); } SetupComboServer( ); OnSelchangeComboServer( ); AfxGetQSProfile().StoreProfile(); } }
// This function sets the text to show in the button tooltip. // // Parameters: // [IN] nText // ID number of the string resource containing the text to show. // [IN] bActivate // If TRUE the tooltip will be created active. // void CButtonST::SetTooltipText(int nText, BOOL bActivate) { CString sText; // Load string resource sText = AfxModuleLoadString(nText); // If string resource is not empty if (sText.IsEmpty() == FALSE) SetTooltipText((LPCTSTR)sText, bActivate); } // End of SetTooltipText
BOOL CKSFileDialog::DoPromptFileName(CString& fileName, UINT nIDSTitle, DWORD lFlags, BOOL bOpenFileDialog, CDocTemplate* pTemplate) { CString title; title = AfxModuleLoadString(nIDSTitle); if (m_pApp==NULL) {ASSERT (FALSE);} //set the m_pApp app point before you call this function ASSERT(m_pApp->m_pDocManager != NULL); m_ofn.Flags |= lFlags; CString strFilter; CString strDefault; if (nIDSTitle==AFX_IDS_SAVEFILE || nIDSTitle==AFX_IDS_SAVEFILECOPY) { POSITION pos = m_pApp->GetFirstDocTemplatePosition(); BOOL bFirst = TRUE; while (pos != NULL) { CDocTemplate* pTemplate = (CDocTemplate*)m_pApp->GetNextDocTemplate(pos); AppendFilterSuffix(strFilter, m_ofn, pTemplate, bFirst ? &strDefault : NULL); bFirst = FALSE; } } else { if (m_StrFilter.GetLength()==0) strFilter = "My File Format (*.mff)|*.mff|My File Format Files (*.mff)"; else strFilter = m_StrFilter; } m_ofn.nMaxCustFilter++; LPTSTR pch = strFilter.GetBuffer(0); // modify the buffer in place // MFC delimits with '|' not '\0' while ((pch = _tcschr(pch, '|')) != NULL) *pch++ = '\0'; m_ofn.lpstrFilter = strFilter; m_ofn.lpstrTitle = title; m_ofn.lpstrFile = fileName.GetBuffer(_MAX_PATH); m_ofn.hwndOwner=m_pApp->m_pMainWnd->GetSafeHwnd() ; m_ofn.Flags&=OFN_EXPLORER|OFN_PATHMUSTEXIST|OFN_OVERWRITEPROMPT;//|OFN_ENABLEHOOK; int nResult = DoModal(); fileName.ReleaseBuffer(); return nResult == IDOK; }
void CSelectSrvDlg::OnOK() { m_btnOK.EnableWindow( FALSE ); UpdateData( ); int nSel = m_comboServer.GetCurSel(); if( CB_ERR == nSel ) { AfxMessageBox( AfxModuleLoadString(IDS_SELECTSRV_NOSELECTED) ); m_btnOK.EnableWindow( TRUE ); return; } int i = m_comboServer.GetItemData(nSel); CQuoteServerArray & aServers = AfxGetQSProfile().GetQuoteServers(); if( i >= 0 && i < aServers.GetSize() ) { AfxGetQSProfile().SetCurrentServer(i); CQuoteServer & qs = aServers.ElementAt(i); // Save qs.m_strUser = m_strUser; qs.m_strPasswd = m_strPasswd; qs.m_bSavePasswd = m_bSavePasswd; if( !qs.m_bSavePasswd ) qs.m_strPasswd.Empty(); // Load m_strAddress = qs.m_strAddress; m_nPort = qs.m_nPort; } AfxGetQSProfile().StoreProfile(); // Connect BOOL bSuccess = CTWSocket::GetInstance().BeginWorking( AfxGetQSProfile().GetAlias(GetServer()), GetPort(), GetUser(), GetPasswd() ); if( !bSuccess ) { AfxMessageBox( CTWSocket::GetInstance().GetLastErrorString(), MB_OK ); return; } CDialog::OnOK(); }
void CEditSrvDlg::OnOK() { // TODO: Add extra validation here UpdateData( ); if( m_strAddress.IsEmpty() ) { AfxMessageBox( AfxModuleLoadString(IDS_EDITSRV_NOADDRESS) ); return; } if( m_strName.IsEmpty() ) { m_strName = m_strAddress; } CDialog::OnOK(); }
void CStartupDlg::OnOffline() { m_btnOK.EnableWindow( FALSE ); m_btnOffline.EnableWindow( FALSE ); UpdateData( ); m_ctrlProgress.ShowWindow( SW_SHOW ); m_staticInfo.SetWindowText( AfxModuleLoadString(IDS_STARTUP_LOADPROGRAM) ); ASSERT( m_pfnLoadProgram ); if( AfxGetStkReceiver().m_bFirst && m_pfnLoadProgram && !m_pfnLoadProgram( GetSafeHwnd(), 0, STKLIB_MAX_PROGRESS ) ) { CDialog::OnCancel(); return; } AfxGetStkReceiver().m_bFirst = FALSE; CDialog::OnOK(); }
void CStartupDlg::OnOK() { m_btnOK.EnableWindow( FALSE ); m_btnOffline.EnableWindow( FALSE ); UpdateData( ); m_ctrlProgress.ShowWindow( SW_SHOW ); int nSel = m_comboServer.GetCurSel(); if( CB_ERR == nSel ) { AfxMessageBox( AfxModuleLoadString(IDS_SELECTSRV_NOSELECTED) ); m_btnOK.EnableWindow( TRUE ); if( !m_bDisableOffline ) m_btnOffline.EnableWindow( TRUE ); m_ctrlProgress.ShowWindow( SW_HIDE ); return; } int i = m_comboServer.GetItemData(nSel); CQuoteServerArray & aServers = AfxGetQSProfile().GetQuoteServers(); if( i >= 0 && i < aServers.GetSize() ) { AfxGetQSProfile().SetCurrentServer(i); CQuoteServer & qs = aServers.ElementAt(i); // Save qs.m_strUser = m_strUser; qs.m_strPasswd = m_strPasswd; qs.m_bSavePasswd = m_bSavePasswd; if( !qs.m_bSavePasswd ) qs.m_strPasswd.Empty(); // Load m_strAddress = qs.m_strAddress; m_nPort = qs.m_nPort; } AfxGetQSProfile().StoreProfile(); m_staticInfo.SetWindowText( AfxModuleLoadString(IDS_STARTUP_CONNECTSERVER) ); AfxBeginThread( RefreshServers, NULL, THREAD_PRIORITY_NORMAL); if( !AfxGetStkReceiver().NetEngineBeginWorking( m_strAddress, m_nPort, m_strUser, m_strPasswd ) ) { m_staticInfo.SetWindowText( AfxModuleLoadString(IDS_STARTUP_CONNECTFAILED) ); m_btnOK.EnableWindow( TRUE ); if( !m_bDisableOffline ) m_btnOffline.EnableWindow( TRUE ); m_ctrlProgress.ShowWindow( SW_HIDE ); return; } m_staticInfo.SetWindowText( AfxModuleLoadString(IDS_STARTUP_LOADPROGRAM) ); ASSERT( m_pfnLoadProgram ); if( AfxGetStkReceiver().m_bFirst && m_pfnLoadProgram && !m_pfnLoadProgram( GetSafeHwnd(), 0, STKLIB_MAX_PROGRESS ) ) { CDialog::OnCancel(); return; } AfxGetStkReceiver().m_bFirst = FALSE; CDialog::OnOK(); }