void CMainFrame::OnWorkOffline() { CBCGPIE7DemoView::m_bWorkOffline = !CBCGPIE7DemoView::m_bWorkOffline; POSITION posTemplate = theApp.m_pDocManager->GetFirstDocTemplatePosition (); while (posTemplate != NULL) { CDocTemplate* pTemplate = theApp.m_pDocManager->GetNextDocTemplate (posTemplate); if (pTemplate != NULL) { POSITION posDocument = pTemplate->GetFirstDocPosition (); while (posDocument != NULL) { CDocument* pDocument = pTemplate->GetNextDoc (posDocument); if (pDocument != NULL) { POSITION posView = pDocument->GetFirstViewPosition (); while (posView != NULL) { CHtmlView* pView = DYNAMIC_DOWNCAST(CHtmlView, pDocument->GetNextView (posView)); if (pView != NULL) { pView->SetOffline (CBCGPIE7DemoView::m_bWorkOffline); } } } } } } }
void CMainFrame::OnViewDeletedrecords() { m_bShowDeletedRecords = !m_bShowDeletedRecords; CWinApp* pApp = AfxGetApp(); ASSERT_VALID(pApp); // Iterate through the application's document templates list POSITION posTemplate = pApp->GetFirstDocTemplatePosition(); while(posTemplate) { // For each document template object... CDocTemplate* pTemplate = pApp->GetNextDocTemplate(posTemplate); ASSERT_VALID(pTemplate); ASSERT_KINDOF(CDocTemplate, pTemplate); // Iterate through the template's document list POSITION posDocument = pTemplate->GetFirstDocPosition(); while(posDocument) { // For each document object... CDocument* pDoc = pTemplate->GetNextDoc(posDocument); ASSERT_VALID(pDoc); ASSERT_KINDOF(CDocument, pDoc); // reload records POSITION pos = pDoc->GetFirstViewPosition(); while (pos) ((CDBFExplorerView *)pDoc->GetNextView(pos))->ShowRecords(m_bShowDeletedRecords); } } }
HRESULT CDxtexApp::RestoreDeviceObjects(VOID) { // Tell each view of each doc to restore POSITION pos = GetFirstDocTemplatePosition(); CDocTemplate* pDocTemplate = GetNextDocTemplate( pos ); pos = pDocTemplate->GetFirstDocPosition(); for( ; ; ) { CDocument* pDoc = NULL; if( pos == NULL ) break; pDoc = pDocTemplate->GetNextDoc( pos ); if( pDoc == NULL ) break; POSITION posView; CDxtexView* pView = NULL; posView = pDoc->GetFirstViewPosition(); for( ; ; ) { if( posView == NULL ) break; pView = (CDxtexView*)pDoc->GetNextView( posView ); if( pView == NULL ) break; pView->RestoreDeviceObjects(); } } return S_OK; }
void CMainFrame::SetConfig(SDComCfg *sDComCfg) { POSITION appPos, templatePos; CDocTemplate *pTemplate; CDComDoc *pDoc; appPos = AfxGetApp()->GetFirstDocTemplatePosition(); while (appPos) { pTemplate = AfxGetApp()->GetNextDocTemplate(appPos); if (pTemplate) { templatePos = pTemplate->GetFirstDocPosition(); while (templatePos) { pDoc = (CDComDoc*)pTemplate->GetNextDoc(templatePos); if (pDoc) { pDoc->SetConfig(sDComCfg); } } } } }
void CMainFrame::InvalidateAll() { POSITION appPos, templatePos; CDocTemplate *pTemplate; CDComDoc *pDoc; CDComView *pView; appPos = AfxGetApp()->GetFirstDocTemplatePosition(); while (appPos) { pTemplate = AfxGetApp()->GetNextDocTemplate(appPos); if (pTemplate) { templatePos = pTemplate->GetFirstDocPosition(); while (templatePos) { pDoc = (CDComDoc*)pTemplate->GetNextDoc(templatePos); if (pDoc) { pView = pDoc->GetView(); if (pView) { pView->PostMessage(WM_DOC_UPDATE, 0); pView->Invalidate(); } } } } } }
void CMainFrame::FindTextResetAll() { POSITION appPos, templatePos; CDocTemplate *pTemplate; CDComDoc *pDoc; appPos = AfxGetApp()->GetFirstDocTemplatePosition(); while (appPos) { pTemplate = AfxGetApp()->GetNextDocTemplate(appPos); if (pTemplate) { templatePos = pTemplate->GetFirstDocPosition(); while (templatePos) { pDoc = (CDComDoc*)pTemplate->GetNextDoc(templatePos); if (pDoc) { pDoc->FindTextReset(); } } } } }
void MLocatorView::UpdateView() { POSITION p = theApp.GetFirstDocTemplatePosition(); CDocTemplate* pTemplate = theApp.GetNextDocTemplate(p); p = pTemplate->GetFirstDocPosition(); CLocatorDoc* pDoc = (CLocatorDoc*)pTemplate->GetNextDoc(p); if( 0 != pDoc ) { const MServerStatusMgr* pServerStatusMgr = pDoc->GetLocator()->GetServerStatusMgr(); if( (0 != pServerStatusMgr) && (0 < pServerStatusMgr->GetSize()) ) { CListCtrl& lc = GetListCtrl(); char szBuf[ 128 ]; string strDeadServerIDList; const int nDeadServerCount = pServerStatusMgr->GetDeadServerCount(); _snprintf( szBuf, 127, "%d", pServerStatusMgr->GetSize() ); lc.InsertItem( 0, szBuf ); _snprintf( szBuf, 127, "Run:%d, Dead:%d", pServerStatusMgr->GetLiveServerCount(), nDeadServerCount ); lc.SetItemText( 0, 1, szBuf ); for( int i = 0; i < nDeadServerCount; ++i ) { _snprintf( szBuf, 127, "%d, ", pServerStatusMgr->GetDeadServerIDList()[i] ); strDeadServerIDList += szBuf; } strDeadServerIDList += "\0"; lc.SetItemText( 0, 2, strDeadServerIDList.c_str() ); } } }
BOOL CPlayerFrame::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCopyDataStruct) { CDocTemplate* pTemplate = NULL; POSITION pos; CDocument* pDocument = NULL; pos = AfxGetApp()->GetFirstDocTemplatePosition(); pTemplate = AfxGetApp()->GetNextDocTemplate( pos ); if ( pCopyDataStruct->dwData == 0 && pCopyDataStruct->lpData ) { if ( pTemplate ) { POSITION docpos = pTemplate->GetFirstDocPosition( ); // Loop through documents in this template while ( docpos ) { VERIFY( pDocument = pTemplate->GetNextDoc(docpos) ); // update all view attached to this document pDocument->UpdateAllViews( NULL, WM_PLAYER_ADD_FILE, (CObject*)pCopyDataStruct->lpData ); } } } return CMainFrame::OnCopyData(pWnd, pCopyDataStruct); }
void CCWArrangePage::OnMatchMerge () { CPickMergeDlg dlg; // add all open documents to the list POSITION pos = AfxGetApp ()->GetFirstDocTemplatePosition (); CDocTemplate* pDocTmpl = AfxGetApp ()->GetNextDocTemplate (pos); pos = pDocTmpl->GetFirstDocPosition (); while (pos) dlg.m_arrTrackInfo.Add (((CCdCoverCreator2Doc*) pDocTmpl->GetNextDoc (pos))->m_pTracks); if (dlg.DoModal () == IDOK) { // build merged trackinfo CTracksInfo ti, *pT; for (int i = 0; i < dlg.m_arrTrackInfo.GetSize (); i++) { pT = (CTracksInfo*) dlg.m_arrTrackInfo.GetAt (i); for (int j = 0; j < pT->GetNumTracks (); j++) ti.Add (new CTrack (pT->GetTrack (j))); } // clear tracks if (!dlg.m_DontDeleteExisting) for (int i = 0; i < m_pTracks->GetNumTracks (); i++) m_pTracks->GetTrack (i).SetText ("", ""); // match tracks GetTracksInfo (); m_pTracks->Match (&ti, dlg.m_DontDeleteExisting ? false : true); // display SetTracks (); } }
extern "C" __declspec(dllexport) bool GetWorkspaceName(LPTSTR buffer, int bufSize) { if (!g_app) return false; POSITION pos = g_app->GetFirstDocTemplatePosition(); while (pos) { CDocTemplate* dt = g_app->GetNextDocTemplate(pos); if (strcmp(dt->GetRuntimeClass()->m_lpszClassName, "CProjectWorkspaceDocTemplate") == 0) { POSITION docPos = dt->GetFirstDocPosition(); if (!docPos) break; CDocument* doc = dt->GetNextDoc(docPos); if (!doc) break; strcpy(buffer, doc->GetPathName()); return true; } } return false; }
void CFindByStrDlg::OnOK() { // TODO: Add extra validation here try { UpdateData(TRUE); vector<CRossDoc*> RossDocs; if(GetCheckedRadioButton(IDC_FIND_IN_ALL_DICTS,IDC_FIND_IN_ACTIVE_DICT)==IDC_FIND_IN_ALL_DICTS) { CDocTemplate* pRossDocTemplate = GetRossDocTemplate(); POSITION pos = pRossDocTemplate->GetFirstDocPosition(); while( pos ) RossDocs.push_back ((CRossDoc*)pRossDocTemplate->GetNextDoc(pos)); } else { RossDocs.push_back(m_pActiveRossDoc); }; CWaitCursor C; vector<CRossPocketItem> PocketItems; for (int RossDocNo=0; RossDocNo<RossDocs.size(); RossDocNo++) { CRossDoc* pRossDoc = RossDocs[RossDocNo]; CTempArticle A; A.m_pRoss = pRossDoc->GetRoss(); size_t UnitNo; try { for (UnitNo = 0; UnitNo < pRossDoc->GetRoss()->GetUnitsSize(); UnitNo++) { if (pRossDoc->GetRoss()->IsEmptyArticle(UnitNo)) continue; A.ReadFromDictionary(UnitNo, false, true); if (A.GetArticleStr().find(m_FindString) != -1) PocketItems.push_back(CRossPocketItem(UnitNo, pRossDoc)); }; } catch (...) { string Mess = string ("Errors in article ") + pRossDoc->GetRoss()->GetEntryStr(UnitNo) ; AfxMessageBox (Mess.c_str()); }; }; C.Restore(); OpenPocket(PocketItems, CString("Search Results for ") + m_FindString); } catch (...) { AfxMessageBox ("Something is wrong"); }; CDialog::OnOK(); }
bool CLeftPanelDlgBar::IsLastDocValid() { // look whether the last doc is still valid POSITION pos = AfxGetApp ()->GetFirstDocTemplatePosition (); CDocTemplate* pDocTmpl = AfxGetApp ()->GetNextDocTemplate (pos); for (pos = pDocTmpl->GetFirstDocPosition (); pos; ) if (pDocTmpl->GetNextDoc (pos) == m_pLastDoc) return true; return false; }
void OleDocRoot::SetTitle(LPCTSTR lpszTitle) { CString s(lpszTitle); CDocTemplate* pTempl = GetDocTemplate(); if (pTempl) { flag Found = True; while (Found) { Found = False; POSITION Pos = pTempl->GetFirstDocPosition(); while (Pos && !Found) { CDocument * pDoc = pTempl->GetNextDoc(Pos); if (pDoc!=this) { CString Title = pDoc->GetTitle(); if (Title.GetLength()==s.GetLength() && _stricmp((const char*)s, (const char*)Title)==0) Found = True; } } if (Found) { CString Ext = ""; int DotPos = s.ReverseFind('.'); if (DotPos>=0) { Ext = s.Mid(DotPos, 256); s = s.Left(DotPos); } int _Pos = s.ReverseFind('_'); if (_Pos>=0) { CString ss = s.Mid(_Pos+1, 256); s = s.Left(_Pos+1); if (ss.GetLength()>0) { char Buff[32]; sprintf(Buff, "%d", atoi((const char*)ss) + 1); s += Buff; } else s += "1"; } else s += "_1"; s += Ext; } } } COleLinkingDoc::SetTitle((const char*)s); }
BOOL COleFrameHook::NotifyAllInPlace( BOOL bParam, BOOL (COleFrameHook::*pNotifyFunc)(BOOL bParam)) { ASSERT_VALID(this); HWND hWndFrame = m_hWnd; CWinApp* pApp = AfxGetApp(); // no doc manager - no templates if (pApp->m_pDocManager == NULL) return TRUE; // walk all templates in the application CDocTemplate* pTemplate; POSITION pos = pApp->m_pDocManager->GetFirstDocTemplatePosition(); while (pos != NULL) { pTemplate = pApp->m_pDocManager->GetNextDocTemplate(pos); ASSERT_VALID(pTemplate); ASSERT_KINDOF(CDocTemplate, pTemplate); // walk all documents in the template POSITION pos2 = pTemplate->GetFirstDocPosition(); while (pos2) { COleDocument* pDoc = (COleDocument*)pTemplate->GetNextDoc(pos2); ASSERT_VALID(pDoc); if (pDoc->IsKindOf(RUNTIME_CLASS(COleDocument))) { // walk all COleClientItem objects in the document COleClientItem* pItem; POSITION pos3 = pDoc->GetStartPosition(); while ((pItem = pDoc->GetNextClientItem(pos3)) != NULL) { if (pItem->m_pInPlaceFrame != NULL && pItem->m_pInPlaceFrame->m_lpActiveObject != NULL && pItem->m_pView != NULL && AfxIsDescendant(hWndFrame, pItem->m_pView->m_hWnd)) { // Whew! Found an in-place active item that is // part of this frame window hierarchy. COleFrameHook* pNotifyHook = pItem->m_pInPlaceFrame; if (!(pNotifyHook->*pNotifyFunc)(bParam)) return FALSE; } } } } } return TRUE; }
CDocument* CFileView::FindSkinFile(CString& strPath) { CDocTemplate* pDocTemplate = theApp.GetUIDocTemplate(); POSITION posDoc = pDocTemplate->GetFirstDocPosition(); while (posDoc != NULL) { CDocument* pDoc = pDocTemplate->GetNextDoc(posDoc); if ((pDoc != NULL) && (pDoc->GetPathName() == strPath)) { return pDoc; } } return NULL; }
CWinNotifyDoc* CMainFrame::GetDoc() { //What will be the return value from this function CWinNotifyDoc* pDoc = NULL; POSITION posTemplate = AfxGetApp()->GetFirstDocTemplatePosition(); CDocTemplate* pDocTemplate = AfxGetApp()->GetNextDocTemplate(posTemplate); if (pDocTemplate) { POSITION posDoc = pDocTemplate->GetFirstDocPosition(); pDoc = static_cast<CWinNotifyDoc*>(pDocTemplate->GetNextDoc(posDoc)); } ASSERT(pDoc); return pDoc; }
CBioSIMDoc* CResultDataWnd::GetDocument() { CDocument* pDoc = NULL; CWinApp* pApp = AfxGetApp(); if (pApp) { POSITION pos = pApp->GetFirstDocTemplatePosition(); CDocTemplate* docT = pApp->GetNextDocTemplate(pos); if (docT) { pos = docT->GetFirstDocPosition(); pDoc = docT->GetNextDoc(pos); } } return static_cast<CBioSIMDoc*>(pDoc); }
CWeatherUpdaterDoc* CTaskPropertyWnd::GetDocument() { CWeatherUpdaterDoc* pDoc = NULL; CWinApp* pApp = AfxGetApp(); if (pApp) { POSITION pos = pApp->GetFirstDocTemplatePosition(); CDocTemplate* docT = pApp->GetNextDocTemplate(pos); if (docT) { pos = docT->GetFirstDocPosition(); pDoc = (CWeatherUpdaterDoc*)docT->GetNextDoc(pos); } } return pDoc; }
void Daten::update_display() { CWinApp *a; CDocTemplate *t; CDocument *d; CView *v; POSITION p; a = AfxGetApp(); p = a->GetFirstDocTemplatePosition(); t = a->GetNextDocTemplate( p); p = t->GetFirstDocPosition(); d = t->GetNextDoc( p); p = d->GetFirstViewPosition(); v = d->GetNextView( p); v->RedrawWindow(); }
BOOL OleDocRoot::OnSaveDocument(const char* pszPathName) { gs_pCmd->ProcessAStr("\x1b"); //Ensure there are no half complete commands gs_pCmd->ProcessAStr("\x1b"); //Ensure there are no half complete commands, call more than once! if (gs_Exec.Busy()) { LogError("SysCAD", 0, "Must not be running"); return False; } //KGA : 7/5/96 : document sometimes not active ??? causes cmd to go to wrong document/window!!! //if (pFirstDoc!=this) // OnActivate(True); gs_pCmd->ProcessAStr("\x1b"); //Ensure there are no half complete commands, call more than once! //Check if a SaveAs is using a filename that is allready open in this project... // //TODO RESTORE /****/ const int len = strlen(pszPathName); CDocTemplate* pTempl = GetDocTemplate(); if (pTempl) { POSITION Pos = pTempl->GetFirstDocPosition(); while (Pos) { CDocument * pDoc = pTempl->GetNextDoc(Pos); if (pDoc!=this) { CString PathName = pDoc->GetPathName(); if (PathName.GetLength()==len && _stricmp((const char*)PathName, pszPathName)==0) { LogError("SysCAD", LF_Exclamation, "Save As '%s' failed. Document/window allready open!", pszPathName); return False; } } } } /***/ //Strng Cmd; //Cmd.Set("SAVE DOCUMENT %s\r",pszPathName); //gs_pCmd->ProcessAStr(Cmd()); return COleLinkingDoc::OnSaveDocument(pszPathName);//dn.GetBuffer(0)); }
void CMainFrame::OnFileSaveTerminals() { POSITION appPos, templatePos; CDocTemplate *pTemplate; CDComDoc *pDoc; SDialingDir *psDialingDir; CString szFile; FILE *fTerminalFile; if (GetTerminalFile(FALSE, &szFile)) { fTerminalFile = fopen(szFile.GetBuffer(), "wb"); if (fTerminalFile == NULL) { CString szError; szError.Format("Unable to open file %s", szFile); AfxMessageBox(szError); } else { appPos = AfxGetApp()->GetFirstDocTemplatePosition(); while (appPos) { pTemplate = AfxGetApp()->GetNextDocTemplate(appPos); if (pTemplate) { templatePos = pTemplate->GetFirstDocPosition(); while (templatePos) { pDoc = (CDComDoc*)pTemplate->GetNextDoc(templatePos); if (pDoc) { psDialingDir = pDoc->GetDialingDir(); fwrite(psDialingDir, sizeof(SDialingDir), 1, fTerminalFile); } } } } fclose(fTerminalFile); } } }
CTimeMDoc* CTitlePaneDlg::GetDocument() const { CTimeMDoc* pDoc = NULL; POSITION posDocTmpl = AfxGetApp()->GetFirstDocTemplatePosition(); while(posDocTmpl) { CDocTemplate* pDocTmpl = AfxGetApp()->GetNextDocTemplate(posDocTmpl); POSITION posDoc = pDocTmpl->GetFirstDocPosition(); while(posDoc) { pDoc = (CTimeMDoc*)pDocTmpl->GetNextDoc(posDoc); if((NULL != pDoc) &&(pDoc->IsKindOf(RUNTIME_CLASS(CTimeMDoc)))) break; else pDoc = NULL; } } return pDoc; }
void AppState::TellScriptsToSave() { if (_pApp && _fSaveScriptsBeforeRun) { POSITION posDocTemplate = _pApp->GetFirstDocTemplatePosition(); while (posDocTemplate) { CDocTemplate* pDocTemplate = _pApp->GetNextDocTemplate(posDocTemplate); // get each document open in given document template POSITION posDoc = pDocTemplate->GetFirstDocPosition(); while (posDoc) { CDocument* pDoc = pDocTemplate->GetNextDoc(posDoc); if (pDoc->GetRuntimeClass() == RUNTIME_CLASS(CScriptDocument)) { static_cast<CScriptDocument*>(pDoc)->SaveIfModified(); } } } } }
// FindOpenDocument - if the C++ framework has a document with this name open, // then return a pointer to it, else NULL. CDocument *CProtectedWinApp::FindOpenDocument(const TCHAR *lpszFileName) { POSITION posTempl = m_pDocManager->GetFirstDocTemplatePosition(); CDocument* pOpenDocument = NULL; TCHAR szPath[_MAX_PATH]; if (!AfxFullPath(szPath, lpszFileName)) _tcscpy(szPath, lpszFileName); while (posTempl) { CDocTemplate* pTemplate = m_pDocManager->GetNextDocTemplate(posTempl); ASSERT(pTemplate->IsKindOf(RUNTIME_CLASS(CDocTemplate))); // go through all documents POSITION posDoc = pTemplate->GetFirstDocPosition(); while (posDoc) { CDocument* pDoc = pTemplate->GetNextDoc(posDoc); if (lstrcmpi(pDoc->GetPathName(), szPath) == 0) return pDoc; } } return NULL; }
void CAddNewItem::UpdateViewData() { POSITION pos = theApp.GetFirstDocTemplatePosition(); while (pos != NULL) { CDocTemplate *pDocTemp = theApp.GetNextDocTemplate(pos); POSITION posdoc = pDocTemp->GetFirstDocPosition(); while (posdoc != NULL) { CDocument* pDoc = pDocTemp->GetNextDoc(posdoc); if (pDoc != NULL) { POSITION posview = pDoc->GetFirstViewPosition(); if (posview != NULL) { COrderManagerView* pV = (COrderManagerView*)pDoc->GetNextView(posview); pV->SendMessage(WM_USER_MSG_REFRESH); } } } } }
CRossDoc* CSemanticStrView::FindRossDoc(DictTypeEnum RossType) { CString strPathName = GetNormalizedRossPath(RossType); CDocTemplate* pRossDocTemplate = GetRossDocTemplate(); assert(pRossDocTemplate); CDocument* pDoc; POSITION pos = pRossDocTemplate->GetFirstDocPosition(); while( pos ) { pDoc = pRossDocTemplate->GetNextDoc(pos); CString strPathNameDoc = pDoc->GetPathName(); strPathNameDoc.MakeLower(); if( strPathNameDoc == strPathName ) { return (CRossDoc*)pDoc; } } return 0; }
STDMETHODIMP CFWDocuments::Item(VARIANT Index, IFWDocument* *ppVal) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); if(!m_pApp) return E_FAIL; *ppVal = NULL; FW_Document* pDoc = NULL; int nIndex = 0; POSITION pos = m_pApp->GetFirstDocTemplatePosition(); while (pos) { CDocTemplate* pTemplate = (CDocTemplate*)m_pApp->GetNextDocTemplate(pos); POSITION pos2 = pTemplate->GetFirstDocPosition(); while (pos2) { FW_Document* pDocTemp = (FW_Document*)(pTemplate->GetNextDoc(pos2)); if(pDocTemp) { if( (Index.vt==VT_I4 && (Index.lVal-1)==nIndex) || (Index.vt==VT_BSTR && pDocTemp->GetTitle()==CString(Index.bstrVal)) ) { pDoc = pDocTemp; break; } nIndex++; } } if(pDoc) break; } if(pDoc) *ppVal = pDoc->GetInterface(); if(*ppVal == NULL) return E_FAIL; return S_OK; }
STDMETHODIMP CFWDocuments::get_Count(long *pVal) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); if(!m_pApp) return E_FAIL; *pVal = 0; int nIndex = 0; POSITION pos = m_pApp->GetFirstDocTemplatePosition(); while (pos) { CDocTemplate* pTemplate = (CDocTemplate*)m_pApp->GetNextDocTemplate(pos); POSITION pos2 = pTemplate->GetFirstDocPosition(); while (pos2) { CDocument* pDoc = pTemplate->GetNextDoc(pos2); if(pDoc->IsKindOf(RUNTIME_CLASS(FW_Document))) (*pVal)++; } } return S_OK; }
void CUndoPrefPage::WackCmdList() { POSITION TemplatePos = PictPubApp.GetFirstDocTemplate(); POSITION DocPos; CServerDoc *pDoc; CDocTemplate *pTemplate; while (TemplatePos) { pTemplate = PictPubApp.GetNextDocTemplate(TemplatePos); DocPos = pTemplate->GetFirstDocPosition(); while (DocPos) { pDoc = (CServerDoc *)pTemplate->GetNextDoc (DocPos); if (pDoc) { pDoc->m_lpImage->lpCmdList->fSaveCommands = FALSE; DestroyPacketList(&pDoc->m_lpImage->lpCmdList->PacketList); DestroyPacketList(&pDoc->m_lpImage->lpCmdList->UndoPacketList); DestroyPacketList(&pDoc->m_lpImage->lpCmdList->RedoPacketList); } } } }
BOOL DlgFFT::OnInitDialog() { CDialog::OnInitDialog(); m_ok.SetIcon(IDI_G,BS_LEFT); m_canc.SetIcon(IDI_R,BS_LEFT); m_cforcefft.SetCheck(1); //m_cmagnitude.SetCheck(1); m_real.AddString("(None)"); m_real.SetItemData(m_real.GetCount()-1, 0); m_imag.AddString("(None)"); m_imag.SetItemData(m_imag.GetCount()-1, 0); POSITION pos = AfxGetApp()->GetFirstDocTemplatePosition(); while (pos != NULL) { CDocTemplate* pTemplate = AfxGetApp()->GetNextDocTemplate(pos); ASSERT(pTemplate->IsKindOf(RUNTIME_CLASS(CDocTemplate))); POSITION pos2 = pTemplate->GetFirstDocPosition(); while (pos2 != NULL) { CDemoDoc* pDoc = (CDemoDoc*) pTemplate->GetNextDoc(pos2); ASSERT(pDoc->IsKindOf(RUNTIME_CLASS(CDemoDoc))); CString title = pDoc->GetTitle(); m_real.AddString(title); m_real.SetItemData(m_real.GetCount()-1, (DWORD)pDoc); m_imag.AddString(title); m_imag.SetItemData(m_imag.GetCount()-1, (DWORD)pDoc); } } m_real.SetCurSel(0); m_imag.SetCurSel(0); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }