本文整理汇总了C++中CDocument::GetPathName方法的典型用法代码示例。如果您正苦于以下问题:C++ CDocument::GetPathName方法的具体用法?C++ CDocument::GetPathName怎么用?C++ CDocument::GetPathName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDocument
的用法示例。
在下文中一共展示了CDocument::GetPathName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnInitialUpdate
/////////////////////////////////////
// @mfunc Called when view was created - we try to let scintilla load a file if there is one
// @rvalue void | not used
//
void CScintillamfcView::OnInitialUpdate()
{
CView::OnInitialUpdate();
CDocument *pDoc = GetDocument();
CString strTitle = pDoc->GetPathName();
m_wndScintilla.Init();
//m_wndScintilla.LoadFile(strTitle);
m_wndScintilla.SetLexer(SCLEX_CPP);
m_wndScintilla.SendMessage(SCI_SETKEYWORDS, 0, (long)_T(
"argCount and and_eq "
"bitand bitor break "
"cslVersion cslCompiler cslBuilt cslFileName cslFunction "
"case catch const continue "
"default do "
"else extern exists"
"false for "
"if "
"mainArgVals MAXLONG "
"not not_eq "
"or or_eq "
"PATHSEPARATOR "
"resize return "
"sizeof static switch "
"throw true try "
"var void "
"while xor xor_eq"
));
//m_wndScintilla.SendMessage(SCI_SETCONTROLCHARSYMBOL, 0, 0);
//m_wndScintilla.SendMessage(SCI_STYLESETVISIBLE, STYLE_CONTROLCHAR, 0);
//m_wndScintilla.SetControlCharSymbol();
}
示例2: OnGetTabToolTip
LRESULT CMainFrame::OnGetTabToolTip(WPARAM /*wp*/, LPARAM lp)
{
CMFCTabToolTipInfo* pInfo = (CMFCTabToolTipInfo*) lp;
ASSERT(pInfo != NULL);
if (!pInfo)
{
return 0;
}
ASSERT_VALID(pInfo->m_pTabWnd);
if (!pInfo->m_pTabWnd->IsMDITab())
{
return 0;
}
CFrameWnd* pFrame = DYNAMIC_DOWNCAST(CFrameWnd, pInfo->m_pTabWnd->GetTabWnd(pInfo->m_nTabIndex));
if (pFrame == NULL)
{
return 0;
}
CDocument* pDoc = pFrame->GetActiveDocument();
if (pDoc == NULL)
{
return 0;
}
pInfo->m_strText = pDoc->GetPathName();
if(pInfo->m_strText.IsEmpty())
pInfo->m_strText=pDoc->GetTitle();
return 0;
}
示例3: MatchDocType
CDocTemplate::Confidence CDocTemplate::MatchDocType(LPCTSTR lpszPathName,
CDocument*& rpDocMatch)
{
ASSERT(lpszPathName != NULL);
rpDocMatch = NULL;
// go through all documents
POSITION pos = GetFirstDocPosition();
while (pos != NULL)
{
CDocument* pDoc = GetNextDoc(pos);
if (AfxComparePath(pDoc->GetPathName(), lpszPathName))
{
// already open
rpDocMatch = pDoc;
return yesAlreadyOpen;
}
}
// see if it matches our default suffix
CString strFilterExt;
if (GetDocString(strFilterExt, CDocTemplate::filterExt) &&
!strFilterExt.IsEmpty())
{
// see if extension matches
ASSERT(strFilterExt[0] == '.');
LPCTSTR lpszDot = _tcsrchr(lpszPathName, '.');
if (lpszDot != NULL && lstrcmpi(lpszDot, strFilterExt) == 0)
return yesAttemptNative; // extension matches, looks like ours
}
// otherwise we will guess it may work
return yesAttemptForeign;
}
示例4: OnProperties
void CFileView::OnProperties()
{
CMDIFrameWnd *pMain = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *)pMain->GetActiveFrame();
CDocument* pDoc = NULL;
pDoc = pChild->GetActiveDocument();
//9-8添加判断,如果不判断,都关闭后再点击项目管理项,程序会崩溃
if( pDoc!= NULL)
{
CString filePath=pDoc->GetPathName();
filePath.Trim();
filePath.MakeLower();
CString fileEx=filePath.Right(2);
if(fileEx==_T(".t"))
{
int iLength = lstrlen(filePath) ;
int iIndex = filePath.ReverseFind(L'\\') ;
CString fileName = filePath.Right(iLength - iIndex - 1);
((CMainFrame*)AfxGetApp()->m_pMainWnd)->SetProjProperty(fileName,filePath);
}
else
{
((CMainFrame*)AfxGetApp()->m_pMainWnd)->SetProjProperty(_T(""),_T(""));
}
}
}
示例5: GetWorkspaceName
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;
}
示例6: OnCmdRun
void CMainFrame::OnCmdRun()
{
CDocument *pDoc = GetActiveFrame()->GetActiveDocument();
pDoc->DoFileSave();
CString strApp = theApp.CombinePath( theApp.GetPath(), theApp.m_strCompilerApp );
SetEnvironmentVariable( _T("NEWPAS"), '"' + strApp + '"' );
CString strArgs;
// using an environ. var. because cmd /C doesn't support more than 1 quoted path
strArgs.Format( _T("/C %%NEWPAS%% \"%s\" execvm & pause"), (LPCTSTR)pDoc->GetPathName() );
TCHAR szFolder[MAX_PATH];
_tcscpy_s( szFolder, MAX_PATH, pDoc->GetPathName() );
PathRemoveFileSpec( szFolder );
::ShellExecute( 0, _T("open"), _T("cmd"), strArgs, szFolder, SW_SHOW );
}
示例7: PyWinObject_FromTCHAR
// @pymethod string|PyCDocument|GetPathName|Returns the full path name of the current document.
// The string will be empty if no path name has been set.
PyObject *
ui_doc_get_path_name(PyObject *self, PyObject *args)
{
CDocument *pDoc;
if (!(pDoc=PyCDocument::GetDoc(self)))
return NULL;
CHECK_NO_ARGS2(args,GetPathName);
GUI_BGN_SAVE;
CString path = pDoc->GetPathName(); // @pyseemfc CDocument|GetPathName
GUI_END_SAVE;
return PyWinObject_FromTCHAR(path);
}
示例8: OpenDocumentFile
CDocument* CDocTemplateEx::OpenDocumentFile(LPCTSTR lpszPathName, BOOL bMakeVisible)
{
CAIPIApp* pApp = (CAIPIApp*)AfxGetApp();
if (m_docList.GetCount() == 1)
{
CDocument* pDocument = (CDocument*)m_docList.GetHead();
BOOL e = pDocument->GetPathName().IsEmpty();
BOOL m = pDocument->IsModified();
if (lpszPathName != NULL && pDocument->GetPathName().IsEmpty() && pDocument->IsModified())
{
pApp->AipiOpenDocumentFile(lpszPathName);
CWaitCursor wait;
if (!pDocument->OnOpenDocument(lpszPathName))
{
// user has be alerted to what failed in OnOpenDocument
TRACE0("CDocument::OnOpenDocument returned FALSE.\n");
return NULL;
}
pDocument->SetPathName(lpszPathName);
POSITION pos = pDocument->GetFirstViewPosition();
CView* pView = pDocument->GetNextView(pos);
CFrameWnd* pFrame = pView->GetParentFrame();
InitialUpdateFrame(pFrame, pDocument);
return pDocument;
}
}
pApp->AipiOpenDocumentFile(lpszPathName);
return CMultiDocTemplate::OpenDocumentFile(lpszPathName, bMakeVisible);
}
示例9: draw_dcm_header
void CdcmviewerView::draw_dcm_header(CDC *pDC,dicom::DataSet &data,int x, int &y,int line_height)
{
if(m_create_dcm_img_error)
{
CDocument *pDoc = GetDocument();
if(pDoc)
{
CString msg;
msg.Format( _T("unrecognized file :%s"),pDoc->GetPathName());
pDC->TextOut(x,y,msg);
}
else
{
pDC->TextOut(x,y,_T("no file"));
}
y+= line_height;
}
CString text;
CdcmviewerDoc* pDoc = (CdcmviewerDoc*)GetDocument();
if(pDoc && pDoc->m_photometric_interpretation!="RGB")
{
text.Format( _T("ww:%f,wc:%f,"),get_ww(),get_wc());
theApp.DebugOutput(text);
pDC->TextOut(x,y,text);
y += line_height;
}
if(m_number_of_frame>1)
{
text.Format("frame index:%04d,navigate to next frame by key PAGE DOWN/RIGHT ARROW/DOWN ARROW",m_frame_index);
pDC->TextOut(x,y,text);
y += line_height;
}
std::stringstream oss;
for(dicom::DataSet::const_iterator it=data.begin();
it!=data.end();
it++)
{
dicom::Tag tag = it->first;
if(GroupTag(tag)==0x28 || /*GroupTag(tag) == 0x08 ||*/ GroupTag(tag)==0x10)
{
oss.str("");
IndentDumper::write_tag(oss,tag,0);
oss<<it->second;
pDC->TextOut(x,y,oss.str().c_str());
y += line_height;
}
}
}
示例10: OnCmdBuild
void CMainFrame::OnCmdBuild()
{
CDocument *pDoc = GetActiveFrame()->GetActiveDocument();
pDoc->DoFileSave();
CString strFolder = theApp.CombinePath( theApp.GetPath(), theApp.m_strSDKOutput );
CString strApp = theApp.CombinePath( theApp.GetPath(), theApp.m_strCompilerApp );
SetEnvironmentVariable( _T("NEWPAS"), '"' + strApp + '"' );
CString strArgs;
// using an environ. var. because cmd /C doesn't support more than 1 quoted path
strArgs.Format( _T("/C %%NEWPAS%% \"%s\" outvm || pause"), (LPCTSTR)pDoc->GetPathName() );
::ShellExecute( 0, _T("open"), _T("cmd"), strArgs, strFolder, SW_SHOW );
}
示例11: FindSkinFile
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;
}
示例12: LoadHistory
BOOL PSGame::LoadHistory()
{
// Get the name of the game.
CFrameWnd* pFrame = (CFrameWnd*) AfxGetMainWnd();
CDocument* pDoc = pFrame->GetActiveDocument();
CString strName = pDoc->GetPathName();
if (strName == "")
return FALSE;
// Open the history file.
char* path_buffer = strName.GetBuffer(_MAX_PATH);
char drive[_MAX_DRIVE];
char dir[_MAX_DIR];
char fname[_MAX_FNAME];
char ext[_MAX_EXT];
_splitpath( path_buffer, drive, dir, fname, ext );
strName.Format("%s%s%s%s", drive, dir, fname, ".dph");
CFile f;
CFileException fe;
f.Open(strName, CFile::modeRead, &fe);
if (fe.m_cause)
return FALSE;
// Load the history.
PSHistory* pHist = new PSHistory;
CArchive arh(&f, CArchive::load);
pHist->Serialize(arh);
arh.Close();
f.Close();
// If the data in the last step of the history is the same as the game's data, copy the history
// into the game's history. If not, disregard the loaded history.
PSStep* pLastStep = pHist->GetLastStep();
PSData* pLastData = pLastStep->GetData();
if (!(*pLastData == m_Data))// Operator != not defined.
{
AfxMessageBox(IDS_BAD_HISTORY);
delete pHist;
return FALSE;
}
SetHistory(pHist);
SetCurrentStep(pLastStep);
return TRUE;
}
示例13: OnSaveDocument
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));
}
示例14: ComputeProperties
BOOL COXChildFrameState::ComputeProperties(CFrameWnd* pFrameWnd)
{
ASSERT_VALID(this);
// Get the position of the frame window
::ZeroMemory(&m_framePlacement, sizeof(WINDOWPLACEMENT));
m_framePlacement.length = sizeof(WINDOWPLACEMENT);
if (pFrameWnd != NULL)
{
VERIFY(pFrameWnd->GetWindowPlacement(&m_framePlacement));
if(!pFrameWnd->IsWindowVisible())
{
m_framePlacement.showCmd=SW_HIDE;
}
}
// Get the document and view of this frame
CDocument* pDoc = NULL;
CView* pView = NULL;
if (!GetDocView(pFrameWnd, pDoc, pView))
{
TRACE0("COXChildFrameState::ComputeProperties : Failed to get the doc-view for this frame, failing\n");
return FALSE;
}
// Get the file path of the document
if (pDoc != NULL)
m_sDocPath = pDoc->GetPathName();
// Store the name of the classes of doc, frame and view
if (pDoc != NULL)
m_sDocClassName = pDoc->GetRuntimeClass()->m_lpszClassName;
if (pFrameWnd != NULL)
m_sFrameClassName = pFrameWnd->GetRuntimeClass()->m_lpszClassName;
if (pView != NULL)
m_sViewClassName = pView->GetRuntimeClass()->m_lpszClassName;
EmptySplitterPanes(m_pSplitterPanes);
if (m_bSaveSplitterPanes)
ComputeSplitterPanes(pFrameWnd);
ASSERT_VALID(this);
return TRUE;
}
示例15: OnInitDialog
BOOL CBackStagePageInfo::OnInitDialog()
{
LFDialog::OnInitDialog();
LFStaticLayout* pLayout = (LFStaticLayout*)GetLayout();
ASSERT_VALID(pLayout);
pLayout->AddAnchor(IDC_PATH_LABEL, LFStaticLayout::e_MoveTypeNone, LFStaticLayout::e_SizeTypeHorz);
pLayout->AddAnchor(IDC_SEPARATOR_1, LFStaticLayout::e_MoveTypeNone, LFStaticLayout::e_SizeTypeHorz);
pLayout->AddAnchor(IDC_TEXT1, LFStaticLayout::e_MoveTypeNone, LFStaticLayout::e_SizeTypeHorz);
pLayout->AddAnchor(IDC_SEPARATOR_2, LFStaticLayout::e_MoveTypeNone, LFStaticLayout::e_SizeTypeHorz);
pLayout->AddAnchor(IDC_TEXT2, LFStaticLayout::e_MoveTypeNone, LFStaticLayout::e_SizeTypeHorz);
pLayout->AddAnchor(IDC_SEPARATOR_3, LFStaticLayout::e_MoveTypeNone, LFStaticLayout::e_SizeTypeHorz);
pLayout->AddAnchor(IDC_TEXT3, LFStaticLayout::e_MoveTypeNone, LFStaticLayout::e_SizeTypeHorz);
pLayout->AddAnchor(IDC_SEPARATOR_4, LFStaticLayout::e_MoveTypeHorz, LFStaticLayout::e_SizeTypeVert);
pLayout->AddAnchor(IDC_INFO_LABEL, LFStaticLayout::e_MoveTypeHorz, LFStaticLayout::e_SizeTypeNone);
pLayout->AddAnchor(IDC_SEPARATOR_5, LFStaticLayout::e_MoveTypeHorz, LFStaticLayout::e_SizeTypeNone);
pLayout->AddAnchor(IDC_PREVIEW, LFStaticLayout::e_MoveTypeHorz, LFStaticLayout::e_SizeTypeNone);
pLayout->AddAnchor(IDC_TEXT4, LFStaticLayout::e_MoveTypeHorz, LFStaticLayout::e_SizeTypeNone);
CFrameWnd* pMainFrame = (CFrameWnd*)AfxGetMainWnd();
CFrameWnd* pFrame = pMainFrame->GetActiveFrame();
if (pFrame != NULL)
{
CDocument* pDoc = pFrame->GetActiveDocument();
if (pDoc != NULL)
{
m_strDocName = pDoc->GetTitle();
m_strPath = pDoc->GetPathName();
}
}
PreparePreviewBitmap();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}