当前位置: 首页>>代码示例>>C++>>正文


C++ SetFileName函数代码示例

本文整理汇总了C++中SetFileName函数的典型用法代码示例。如果您正苦于以下问题:C++ SetFileName函数的具体用法?C++ SetFileName怎么用?C++ SetFileName使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SetFileName函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: on_StartTracking

void MainWindow::on_StartTracking()
{
	if (m_ToolModelFileName.empty())
	{
		auto sphere = vtkSmartPointer<vtkSphereSource>::New();
		sphere->SetRadius(10);
		sphere->Update();
		m_Tool = sphere->GetOutput();
	}
	auto reader = vtkSmartPointer<vtkSTLReader>::New();
	reader->SetFileName(m_ToolModelFileName.c_str());
	reader->Update();
	m_Tool = reader->GetOutput();

	//connect tracking object
	m_3d_View->AddPolySource(m_Tool);
	std::cout << "Number of actors: " << m_3d_View->GetNumberOfActors() << std::endl;
	m_3d_View->ConnectObjectTracker(1, 0);
	m_3d_View->SetReferenceIndex(1);

	//add target to view
	if (!m_TargetFileName.empty())
	{
		auto reader_ = vtkSmartPointer<vtkSTLReader>::New();
		reader_->SetFileName(m_TargetFileName.c_str());
		reader_->Update();
		m_Target = reader_->GetOutput();
		m_3d_View->AddPolySource(m_Target);
	}

	m_3d_View->StartTracking();
}
开发者ID:Beastmaster,项目名称:Tracking3D_Example,代码行数:32,代码来源:mainWindow.cpp

示例2: DoSaveFileAs

static BOOL
DoSaveFileAs(
    HWND hWnd,
    PCONSOLE_CHILDFRM_WND pChildInfo)
{
    OPENFILENAME saveas;
    TCHAR szPath[MAX_PATH];

    DPRINT1("pChildInfo %p\n", pChildInfo);
    DPRINT1("FileName %S\n", pChildInfo->pFileName);

    ZeroMemory(&saveas, sizeof(saveas));

    if (pChildInfo->pFileName != NULL)
    {
        _tcscpy(szPath, pChildInfo->pFileName);
    }
    else
    {
        GetWindowText(pChildInfo->hwnd, szPath, MAX_PATH);
        _tcscat(szPath, TEXT(".msc"));
    }

    saveas.lStructSize = sizeof(OPENFILENAME);
    saveas.hwndOwner = hWnd;
    saveas.hInstance = hAppInstance;
    saveas.lpstrFilter = L"MSC Files\0*.msc\0";
    saveas.lpstrFile = szPath;
    saveas.nMaxFile = MAX_PATH;
    saveas.Flags = OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT;
    saveas.lpstrDefExt = L"msc";

    if (GetSaveFileName(&saveas))
    {
        /* HACK: Because in ROS, Save-As boxes don't check the validity
         * of file names and thus, here, szPath can be invalid !! We only
         * see its validity when we call DoSaveFile()... */
        SetFileName(pChildInfo, szPath);

        if (DoSaveFile(hWnd, pChildInfo))
        {
//            UpdateWindowCaption();
            return TRUE;
        }
        else
        {
            SetFileName(pChildInfo, NULL);
            return FALSE;
        }
    }
    else
    {
        return FALSE;
    }
}
开发者ID:Moteesh,项目名称:reactos,代码行数:55,代码来源:console.c

示例3: DIALOG_FileSaveAs

BOOL DIALOG_FileSaveAs(VOID)
{
    OPENFILENAME saveas;
    TCHAR szDir[MAX_PATH];
    TCHAR szPath[MAX_PATH];

    ZeroMemory(&saveas, sizeof(saveas));

    GetCurrentDirectory(SIZEOF(szDir), szDir);
    if (Globals.szFileName[0] == 0)
        _tcscpy(szPath, txt_files);
    else
        _tcscpy(szPath, Globals.szFileName);

    saveas.lStructSize = sizeof(OPENFILENAME);
    saveas.hwndOwner = Globals.hMainWnd;
    saveas.hInstance = Globals.hInstance;
    saveas.lpstrFilter = Globals.szFilter;
    saveas.lpstrFile = szPath;
    saveas.nMaxFile = SIZEOF(szPath);
    saveas.lpstrInitialDir = szDir;
    saveas.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY |
                   OFN_EXPLORER | OFN_ENABLETEMPLATE | OFN_ENABLEHOOK;
    saveas.lpstrDefExt = szDefaultExt;
    saveas.lpTemplateName = MAKEINTRESOURCE(DIALOG_ENCODING);
    saveas.lpfnHook = DIALOG_FileSaveAs_Hook;

    if (GetSaveFileName(&saveas))
    {
        /* HACK: Because in ROS, Save-As boxes don't check the validity
         * of file names and thus, here, szPath can be invalid !! We only
         * see its validity when we call DoSaveFile()... */
        SetFileName(szPath);
        if (DoSaveFile())
        {
            UpdateWindowCaption();
            return TRUE;
        }
        else
        {
            SetFileName(_T(""));
            return FALSE;
        }
    }
    else
    {
        return FALSE;
    }
}
开发者ID:RPG-7,项目名称:reactos,代码行数:49,代码来源:dialog.c

示例4: logfile

/*------------------------------------------------------------------------*/
logfile :: logfile(const char *file_name, bool create, unsigned long max_size)
{
  SetFileName(file_name);
	CreateFlag = create;
  MaxSize = max_size;

}
开发者ID:olegyurchenko,项目名称:dda-control,代码行数:8,代码来源:logfile.cpp

示例5: DIALOG_FileSaveAs

VOID DIALOG_FileSaveAs(VOID)
{
    OPENFILENAME saveas;
    TCHAR szDir[MAX_PATH];
    TCHAR szPath[MAX_PATH];

    ZeroMemory(&saveas, sizeof(saveas));

    GetCurrentDirectory(SIZEOF(szDir), szDir);
    if (Globals.szFileName[0] == 0)
        _tcscpy(szPath, txt_files);
    else
        _tcscpy(szPath, Globals.szFileName);

    saveas.lStructSize       = sizeof(OPENFILENAME);
    saveas.hwndOwner         = Globals.hMainWnd;
    saveas.hInstance         = Globals.hInstance;
    saveas.lpstrFilter       = Globals.szFilter;
    saveas.lpstrFile         = szPath;
    saveas.nMaxFile          = SIZEOF(szPath);
    saveas.lpstrInitialDir   = szDir;
    saveas.Flags             = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT |
        OFN_HIDEREADONLY | OFN_EXPLORER | OFN_ENABLETEMPLATE | OFN_ENABLEHOOK;
    saveas.lpstrDefExt       = szDefaultExt;
    saveas.lpTemplateName    = MAKEINTRESOURCE(DIALOG_ENCODING);
    saveas.lpfnHook          = DIALOG_FileSaveAs_Hook;

    if (GetSaveFileName(&saveas)) {
        SetFileName(szPath);
        UpdateWindowCaption();
        DoSaveFile();
    }
}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:33,代码来源:dialog.c

示例6: DoCloseFile

/**
 * Returns:
 *   TRUE  - User agreed to close (both save/don't save)
 *   FALSE - User cancelled close by selecting "Cancel"
 */
BOOL DoCloseFile(VOID)
{
    int nResult;

    if (SendMessage(Globals.hEdit, EM_GETMODIFY, 0, 0))
    {
        /* prompt user to save changes */
        nResult = AlertFileNotSaved(Globals.szFileName);
        switch (nResult)
        {
            case IDYES:
                if(!DIALOG_FileSave())
                    return FALSE;
                break;

            case IDNO:
                break;

            case IDCANCEL:
                return FALSE;

            default:
                return FALSE;
        }
    }

    SetFileName(empty_str);
    UpdateWindowCaption();

    return TRUE;
}
开发者ID:RPG-7,项目名称:reactos,代码行数:36,代码来源:dialog.c

示例7: tr

void MainWindow::on_Load_Atlas()
{
	QString fileName = QFileDialog::getOpenFileName(this,
		tr("Open Image"), "E:/", tr("Image Files (*.nii)"));
	if (fileName.isEmpty())
	{
		return;
	}
	else
	{
		m_AtlasFileName = fileName.toStdString();
		auto reader = vtkSmartPointer<vtkNIFTIImageReader>::New();
		reader->SetFileName(m_AtlasFileName.c_str());
		reader->Update();
		m_Atlas = reader->GetOutput();

		m_Sagittal_View->Set_Mask_Img(m_Atlas);
		m_Axial_View->Set_Mask_Img(m_Atlas);
		m_Coronal_View->Set_Mask_Img(m_Atlas);

		m_Sagittal_View->RenderView();
		m_Axial_View->RenderView();
		m_Coronal_View->RenderView();
	}

}
开发者ID:Beastmaster,项目名称:Tracking3D_Example,代码行数:26,代码来源:mainWindow.cpp

示例8: DIALOG_FileSaveAs

VOID DIALOG_FileSaveAs(VOID)
{
    OPENFILENAME saveas;
    WCHAR szPath[MAX_PATH];
    WCHAR szDir[MAX_PATH];
    static const WCHAR szDefaultExt[] = { 't','x','t',0 };
    static const WCHAR txt_files[] = { '*','.','t','x','t',0 };

    ZeroMemory(&saveas, sizeof(saveas));

    GetCurrentDirectory(SIZEOF(szDir), szDir);
    lstrcpy(szPath, txt_files);

    saveas.lStructSize       = sizeof(OPENFILENAME);
    saveas.hwndOwner         = Globals.hMainWnd;
    saveas.hInstance         = Globals.hInstance;
    saveas.lpstrFilter       = Globals.szFilter;
    saveas.lpstrFile         = szPath;
    saveas.nMaxFile          = SIZEOF(szPath);
    saveas.lpstrInitialDir   = szDir;
    saveas.Flags             = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT |
        OFN_HIDEREADONLY;
    saveas.lpstrDefExt       = szDefaultExt;

    if (GetSaveFileName(&saveas)) {
        SetFileName(szPath);
        UpdateWindowCaption();
        DoSaveFile();
    }
}
开发者ID:howard5888,项目名称:wineT,代码行数:30,代码来源:dialog.c

示例9: SetFileName

void GcEditorSequenceMain::OnOK()
{
	// TODO: 여기에 특수화된 코드를 추가 및/또는 기본 클래스를 호출합니다.

	SetFileName();
	GcEditorPropertyPage::OnOK();
}
开发者ID:issamux,项目名称:WebGame,代码行数:7,代码来源:GcEditorSequenceMain.cpp

示例10: tr

void CalibrationWindow::Act_Load_nii()
{
	QString fileName = QFileDialog::getOpenFileName(this,
		tr("Open Image"), "E:/", tr("Image Files (*.nii)"));
	if (fileName.isEmpty())
	{
		return;
	}
	
	auto reader = vtkSmartPointer<vtkNIFTIImageReader>::New();
	reader->SetFileName(fileName.toStdString().c_str());
	reader->Update();

	//extract 3d model
	auto marchingCubes = vtkSmartPointer<vtkMarchingCubes>::New();
	marchingCubes->SetInputData(reader->GetOutput());
	marchingCubes->SetValue(0, 500);
	marchingCubes->Update();

	auto mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
	mapper->SetInputData(marchingCubes->GetOutput());

	m_Actor2 = vtkSmartPointer<vtkActor>::New();
	m_Actor2->SetMapper(mapper);
	m_Renderer->AddActor(m_Actor2);
	m_Renderer->ResetCamera();
	m_View->Render();
}
开发者ID:Beastmaster,项目名称:Tracking3D_Example,代码行数:28,代码来源:CalibrationWindow.cpp

示例11: HandleCommandLine

/***********************************************************************
 *          HandleCommandLine
 *
 *  Handle command line options
 *
 *  ARGUMENTS:
 *    - command line options passed to the program (as string):
 *         char *cmdline
 *  RETURNS: none
 */
static void HandleCommandLine(char *cmdline)
{
    /* file name is passed in the command line */
    if (*cmdline) {
        /* Remove double-quotes from filename */
        /* Double-quotes are not allowed in Windows filenames */
        if (cmdline[0] == '"')
        {
            char *wc;
            cmdline++;
            wc = cmdline;
            while (*wc && *wc != '"') wc++;
            *wc = 0;
        }
        if (FileExists(cmdline)) {
            DoOpenFile(cmdline);
            InvalidateRect(Globals.hMainWnd, NULL, false);
        }
        else {
            switch (AlertFileDoesNotExist(cmdline)) {
                case IDYES:
                    SetFileName(cmdline);
                    UpdateWindowCaption();
                    break;

                case IDNO:
                    break;

                case IDCANCEL:
                    DestroyWindow(Globals.hMainWnd);
                    break;
            }
        }
     }
}
开发者ID:leavittx,项目名称:notepad,代码行数:45,代码来源:main.c

示例12: fileName

CLogOutput::CLogOutput()
    : fileName("")
    , filePath("")
{
    // multiple infologs can't exist together!
    assert(this == &logOutput);
    assert(!filelog);

    SetFileName("infolog.txt");

    bool doRotateLogFiles = false;
    std::string rotatePolicy = "auto";
    if (configHandler != NULL) {
        rotatePolicy = configHandler->GetString("RotateLogFiles");
    }
    if (rotatePolicy == "always") {
        doRotateLogFiles = true;
    } else if (rotatePolicy == "never") {
        doRotateLogFiles = false;
    } else { // auto
#ifdef DEBUG
        doRotateLogFiles = true;
#else
        doRotateLogFiles = false;
#endif
    }
    SetLogFileRotating(doRotateLogFiles);
}
开发者ID:N0U,项目名称:spring,代码行数:28,代码来源:LogOutput.cpp

示例13: memset

BOOL OSndStreamWAV::OpenStream( const CUString& strFileName )
{
	SF_INFO wfInfo;

    memset(&wfInfo,0,sizeof(SF_INFO));
	wfInfo.samplerate  = GetSampleRate();
	wfInfo.frames      = -1;
	wfInfo.sections	   = 1;
	wfInfo.channels    = GetChannels();
	wfInfo.format      = (SF_FORMAT_WAV | m_OutputFormat) ;

	// Set file name
	SetFileName(strFileName);
	
    CUStringConvert strCnv;

	// Open stream
    #ifdef _UNICODE
    if (! (m_pSndFile = sf_open(	(const tchar*)strCnv.ToT( GetFileName() + _W( "." ) + GetFileExtention() ),
									SFM_WRITE,
									&wfInfo ) ) )
    #else
	if (! (m_pSndFile = sf_open(	strCnv.ToT( GetFileName() + _W( "." ) + GetFileExtention() ),
									SFM_WRITE,
									&wfInfo ) ) )
    #endif
	{
		ASSERT( FALSE );
		return FALSE;
	}

	// return Success
	return TRUE;
}
开发者ID:joshlong,项目名称:libcd,代码行数:34,代码来源:OSndStreamWAV.cpp

示例14: GetFileName

//---------------------------------------------------
//
void	TargetNode::ConvertFileName()
{
	char	*pszName = GetFileName(), szNewName[2*_MAX_PATH+1];

	if ( pszName )
		{
		 InternalConvertFileName(pszName, szNewName);
		 DeleteFileName();
		 SetFileName(szNewName );
		}
	pszName = GetFilePath();
	if ( pszName )
		{
		 InternalConvertFileName(pszName, szNewName);
		 DeleteFilePath();
		 SetFilePath(szNewName );
		}

	TargetNode* pTarget = GetFirstChildTarget();
	while ( pTarget )
		{
		 pTarget->ConvertFileName();
		 pTarget= pTarget->GetNext();
		}
}
开发者ID:kit-transue,项目名称:software-emancipation-discover,代码行数:27,代码来源:targetnodefiles.cpp

示例15: FileSave

void SubsController::Save(agi::fs::path const& filename, std::string const& encoding) {
	const SubtitleFormat *writer = SubtitleFormat::GetWriter(filename);
	if (!writer)
		throw "Unknown file type.";

	int old_autosaved_commit_id = autosaved_commit_id, old_saved_commit_id = saved_commit_id;
	try {
		autosaved_commit_id = saved_commit_id = commit_id;

		// Have to set this now for the sake of things that want to save paths
		// relative to the script in the header
		this->filename = filename;
		config::path->SetToken("?script", filename.parent_path());

		FileSave();

		writer->WriteFile(context->ass, filename, encoding);
	}
	catch (...) {
		autosaved_commit_id = old_autosaved_commit_id;
		saved_commit_id = old_saved_commit_id;
		throw;
	}

	SetFileName(filename);
}
开发者ID:seawaveT,项目名称:Aegisub,代码行数:26,代码来源:subs_controller.cpp


注:本文中的SetFileName函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。