• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ PathRemoveFileSpec函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: main

int main(int argc, char** argv) {

	char szPath[MAX_PATH];

	for (int i = 1; i < argc; i++) {

		PathRemoveFileSpec(lstrcpy(szPath, argv[i]));

		WIN32_FIND_DATA findData;
		HANDLE hFind = FindFirstFile(argv[i], &findData);
		if (hFind != INVALID_HANDLE_VALUE) {
			do {
				char szFile[MAX_PATH];

				PathAppend(lstrcpy(szFile, szPath), findData.cFileName);

				printf("%s\n", szFile);

				wc_info wci;

				FILE* fp = fopen(szFile, "r");
				if (fp) {
					ZeroMemory(&wci, sizeof(wci));

					wci.m_size = _filelength(fileno(fp));
					wci.m_p = malloc(wci.m_size);
					fread(wci.m_p, sizeof(char), wci.m_size, fp);
					fclose(fp);

					wc(wci);

					printf("バイト数: %u\n", wci.m_count_byte);
					printf("  文字数: %u\n", wci.m_count_char);

					free(wci.m_p);
				}
			} while (FindNextFile(hFind, &findData));

			FindClose(hFind);
		}
	}

	_getch();

	return 0;
}
开发者ID:willmomo,项目名称:ry2kojima,代码行数:46,代码来源:wc.cpp


示例2: ZeroMemory

bool ConfigurationHolder::buildConfigFilePath(const WCHAR* fileName)
{
	ZeroMemory(configPath, sizeof(configPath));

	if (!GetModuleFileName(0, configPath, _countof(configPath)))
	{
#ifdef DEBUG_COMMENTS
		Scylla::debugLog.log(L"buildConfigFilePath :: GetModuleFileName failed %d", GetLastError());
#endif
		return false;
	}

	PathRemoveFileSpec(configPath);
	PathAppend(configPath, fileName);

	return true;
}
开发者ID:JohannesHei,项目名称:Scylla,代码行数:17,代码来源:ConfigurationHolder.cpp


示例3: wmain

int wmain( int argc, const wchar_t *argv[] )
{
#ifndef BUILD_SETUP
	if(argc==2)
	{
		if(wcscmp(L"-install",argv[1])==0)
			InstallService();
		else if (wcscmp(L"-uninstall",argv[1])==0)
			UninstallService();
		return 0;
	}
#endif
	SERVICE_TABLE_ENTRY DispatchTable[]={
		{(wchar_t*)g_ServiceName, ServiceMain},
		{NULL, NULL}
	};
	HKEY hKey;
	if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,L"SOFTWARE\\IvoSoft\\ClassicShell",0,KEY_READ|KEY_WOW64_64KEY,&hKey)==ERROR_SUCCESS)
	{
		DWORD log;
		DWORD size=sizeof(log);
		if (RegQueryValueEx(hKey,L"LogService",0,NULL,(BYTE*)&log,&size)==ERROR_SUCCESS && log)
		{
			GetModuleFileName(NULL,g_LogName,_countof(g_LogName));
			PathRemoveFileSpec(g_LogName);
			PathAppend(g_LogName,L"service.log");
			LogText("Starting service\n");
		}

		DWORD dump;
		size=sizeof(dump);

		if (RegQueryValueEx(hKey,L"CrashDump",0,NULL,(BYTE*)&dump,&size)==ERROR_SUCCESS && dump>0)
		{
			if (dump==1) MiniDumpType=MiniDumpNormal;
			if (dump==2) MiniDumpType=MiniDumpWithDataSegs;
			if (dump==3) MiniDumpType=MiniDumpWithFullMemory;
			SetUnhandledExceptionFilter(TopLevelFilter);
		}
		RegCloseKey(hKey);
	}

	StartServiceCtrlDispatcher(DispatchTable);
	return 0;
}
开发者ID:VonChenPlus,项目名称:ClassicShell,代码行数:45,代码来源:ClassicShellService.cpp


示例4: HRESULT

// determine the directory for a given pathname
// (wstring only for now; feel free to make this a template if needed)
/*static*/ wstring File::DirectoryPathOf(wstring path)
{
#ifdef _WIN32
    // Win32 accepts forward slashes, but it seems that PathRemoveFileSpec() does not
    // TODO:
    // "PathCchCanonicalize does the / to \ conversion as a part of the canonicalization, it's
    // probably a good idea to do that anyway since I suspect that the '..' characters might
    // confuse the other PathCch functions" [Larry Osterman]
    // "Consider GetFullPathName both for canonicalization and last element finding." [Jay Krell]
    path = msra::strfun::ReplaceAll<wstring>(path, L"/", L"\\");

    HRESULT hr;
    if (IsWindows8OrGreater()) // PathCchRemoveFileSpec() only available on Windows 8+
    {
        typedef HRESULT(*PathCchRemoveFileSpecProc)(_Inout_updates_(_Inexpressible_(cchPath)) PWSTR, _In_ size_t);
        HINSTANCE hinstLib = LoadLibrary(TEXT("api-ms-win-core-path-l1-1-0.dll"));
        if (hinstLib == nullptr)
            RuntimeError("DirectoryPathOf: LoadLibrary() unexpectedly failed.");
        PathCchRemoveFileSpecProc PathCchRemoveFileSpec = reinterpret_cast<PathCchRemoveFileSpecProc>(GetProcAddress(hinstLib, "PathCchRemoveFileSpec"));
        if (!PathCchRemoveFileSpec)
            RuntimeError("DirectoryPathOf: GetProcAddress() unexpectedly failed.");

        // this is the actual function call we care about
        hr = PathCchRemoveFileSpec(&path[0], path.size());

        FreeLibrary(hinstLib);
    }
    else // on Windows 7-, use older PathRemoveFileSpec() instead
        hr = PathRemoveFileSpec(&path[0]) ? S_OK : S_FALSE;

    if (hr == S_OK) // done
        path.resize(wcslen(&path[0]));
    else if (hr == S_FALSE) // nothing to remove: use .
        path = L".";
    else
        RuntimeError("DirectoryPathOf: Path(Cch)RemoveFileSpec() unexpectedly failed with 0x%08x.", (unsigned int)hr);
#else
    auto pos = path.find_last_of(L"/");
    if (pos != path.npos)
        path.erase(pos);
    else // if no directory path at all, use current directory
        return L".";
#endif
    return path;
}
开发者ID:BorisJineman,项目名称:CNTK,代码行数:47,代码来源:File.cpp


示例5: find_portable_dir

static BOOL find_portable_dir(LPCWSTR base, LPWSTR *result, BOOL *existing) {
    WCHAR buf[4*MAX_PATH] = {0};

    _snwprintf_s(buf, 4*MAX_PATH, _TRUNCATE, L"%s\\calibre-portable.exe", base);
    *existing = true;

    if (file_exists(buf)) {
        *result = _wcsdup(base);
        if (*result == NULL) { show_error(L"Out of memory"); return false; }
        return true;
    }

    WIN32_FIND_DATA fdFile; 
    HANDLE hFind = NULL;
    _snwprintf_s(buf, 4*MAX_PATH, _TRUNCATE, L"%s\\*", base);

    if((hFind = FindFirstFileEx(buf, FindExInfoStandard, &fdFile, FindExSearchLimitToDirectories, NULL, 0)) != INVALID_HANDLE_VALUE) {
        do {
            if(is_dots(fdFile.cFileName)) continue;

            if(fdFile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
                _snwprintf_s(buf, 4*MAX_PATH, _TRUNCATE, L"%s\\%s\\calibre-portable.exe", base, fdFile.cFileName);
                if (file_exists(buf)) {
                    *result = _wcsdup(buf);
                    if (*result == NULL) { show_error(L"Out of memory"); return false; }
                    PathRemoveFileSpec(*result);
                    FindClose(hFind);
                    return true;
                }
            } 
        } while(FindNextFile(hFind, &fdFile));
        FindClose(hFind);
    }

    *existing = false;
    _snwprintf_s(buf, 4*MAX_PATH, _TRUNCATE, L"%s\\Calibre Portable", base);
    if (!CreateDirectory(buf, NULL) && GetLastError() != ERROR_ALREADY_EXISTS) {
        show_last_error(L"Failed to create Calibre Portable folder");
        return false;
    }
    *result = _wcsdup(buf);
    if (*result == NULL) { show_error(L"Out of memory"); return false; }

    return true;
}
开发者ID:Aliminator666,项目名称:calibre,代码行数:45,代码来源:portable-installer.cpp


示例6: GetActiveFrame

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 );
}
开发者ID:valentingalea,项目名称:newpas,代码行数:18,代码来源:MainFrm.cpp


示例7: ZeroMemory

bool TexCubeWnd::OnEnvCreate()
{
	if(!m_xCube.Create(this))
	{
		return false;
	}

	D3DLIGHT9 lgt;
	ZeroMemory(&lgt, sizeof(lgt));
	lgt.Type = D3DLIGHT_DIRECTIONAL;
	lgt.Ambient   = D3DXCOLOR(0.8f, 0.8f, 0.8f, 1.0f);
	lgt.Diffuse   = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);
	lgt.Specular  = D3DXCOLOR(0.2f, 0.2f, 0.2f, 1.0f);
	lgt.Direction = D3DXVECTOR3(1.0f, -1.0f, 0.0f);
	m_pD3Dev9->SetLight(0, &lgt);
	m_pD3Dev9->LightEnable(0, TRUE);

	m_pD3Dev9->SetRenderState(D3DRS_NORMALIZENORMALS, TRUE);
	m_pD3Dev9->SetRenderState(D3DRS_SPECULARENABLE, TRUE);

	char szTexturePath[MAX_PATH] = {0};
	GetModuleFileName(NULL, szTexturePath, sizeof(szTexturePath));
	PathRemoveFileSpec(szTexturePath);
	strcat(szTexturePath, "\\res\\p2c6_tex01.jpg");

	if(!PathFileExists(szTexturePath))
	{
		MessageBox(NULL, "Cannot load texture...", "Error", MB_ICONERROR | MB_OK);
		return false;
	}

	HRESULT hr = D3DXCreateTextureFromFile(m_pD3Dev9, szTexturePath, &m_pTex);
	if(D3D_OK != hr ||
		NULL == m_pTex)
	{
		return false;
	}

	D3DXVECTOR3 pos(0.0f, 0.0f, -4.0f);
	Gfx_SetViewTransform(&pos);
	Gfx_SetProjectionTransform();

	return true;
}
开发者ID:sryanyuan,项目名称:Srender,代码行数:44,代码来源:P2C6_TexCube.cpp


示例8: co_winnt_load_driver_lowlevel_by_name

co_rc_t co_winnt_load_driver_lowlevel_by_name(char *name, char *path) 
{ 
	SC_HANDLE   schSCManager; 
	char fullpath[0x100] = {0,};
	char driverfullpath[0x100] = {0,};
	co_rc_t rc;

	GetModuleFileName(co_current_win32_instance, fullpath, sizeof(fullpath));
	PathRemoveFileSpec(fullpath);
	PathCombine(driverfullpath, fullpath, path);

	co_terminal_print("loading %s\n", driverfullpath);

	schSCManager = OpenSCManager(NULL,                 // machine (NULL == local) 
				     NULL,                 // database (NULL == default) 
				     SC_MANAGER_ALL_ACCESS /* access required */ );

	rc = co_winnt_install_driver_lowlevel(schSCManager, name, driverfullpath);
	if (!CO_OK(rc)) {
		CloseServiceHandle(schSCManager);    
		return rc;
	}

	rc = co_winnt_start_driver_lowlevel(schSCManager, name); 
	if (!CO_OK(rc)) {
		co_winnt_remove_driver_lowlevel(schSCManager, name); 
		CloseServiceHandle(schSCManager);    
		return rc;
	}

#if (0)
	rc = co_os_check_device(name); 
	if (!CO_OK(rc)) {
		co_winnt_stop_driver_lowlevel(schSCManager, name);  
		co_winnt_remove_driver_lowlevel(schSCManager, name); 
		CloseServiceHandle(schSCManager);    
		return rc;
	}
#endif

	CloseServiceHandle(schSCManager);    

	return CO_RC(OK);
} 
开发者ID:matt81093,项目名称:Original-Colinux,代码行数:44,代码来源:driver.c


示例9: _T

ModelPtr XFileLoader::OpenFromResource( int resourceID,float scale )
{
	HRESULT hr = S_OK;

	m_fileName = _T("");

	TCHAR path[MAX_PATH];
	_tcscpy_s( path,MAX_PATH,m_fileName.c_str() );
	PathRemoveFileSpec( path );
	PathAddBackslash( path );
	m_path = path;

	m_scale = scale;

	Graphics* graphics = Graphics::GetInstance();
	IDirect3DDevice9Ptr pD3DDevice = graphics->GetDirect3DDevice();

	m_pAdjacencyBuf = NULL;
	m_pMaterialBuf = NULL;
	m_pEffectInstancesBuf = NULL;
	m_Materials = 0;
	m_pD3DMesh = NULL;

	ModelPtr pModel;

	hr = D3DXLoadMeshFromXResource(
		NULL,
		(LPSTR)MAKEINTRESOURCE( resourceID ),
		(LPSTR)RT_RCDATA,
		D3DXMESH_SYSTEMMEM,
		pD3DDevice,
		&m_pAdjacencyBuf,
		&m_pMaterialBuf,
		&m_pEffectInstancesBuf,
		&m_Materials,
		&m_pD3DMesh );

	if( FAILED(hr) )
	{
		return ModelPtr();
	}

	return ModelPtr( new Model( CreateMeshContainer() ) );
}
开发者ID:ZeusAFK,项目名称:MikuMikuGameEngine,代码行数:44,代码来源:XFileLoader.cpp


示例10: LoadTmpFileList

void CExtractData::DeleteTmpFile()
{
	// Add the last remaining temporary files
	LoadTmpFileList();

	for (std::set<YCString>::iterator itr = m_ssTmpFile.begin(); itr != m_ssTmpFile.end(); )
	{
		TCHAR szTmp[MAX_PATH];
		lstrcpy(szTmp, *itr);

		// Delete temporary files

		if (PathFileExists(szTmp))
		{
			// File exists

			if (!DeleteFile(szTmp))
			{
				// Fails to remove it

				itr++;
				continue;
			}
		}

		while (lstrcmp(szTmp, m_pOption->TmpDir) != 0)
		{
			// Delete folder

			if (!PathRemoveFileSpec(szTmp))
			{
				break;
			}

			RemoveDirectory(szTmp);
		}

		itr = m_ssTmpFile.erase(itr);
	}

	// Save the list of remaining temp files
	SaveTmpFileList();
}
开发者ID:angathorion,项目名称:ExtractData,代码行数:43,代码来源:ExtractData.cpp


示例11: _tcsncpy_s

void CMd5ItemCached::SetMd5Item(CMd5Item *pMd5Item)
{
    if ((pMd5Item != m_pMd5Item) || (pMd5Item->GetVersion() != m_nVersion))
    {
        m_pMd5Item = pMd5Item;
        m_nVersion = pMd5Item->GetVersion();

        if (pMd5Item->GetFileName() == pMd5Item->GetFullPath())
            *m_szFolderPath = 0;
        else
        {
            _tcsncpy_s(m_szFolderPath, MAX_PATH, pMd5Item->GetFullPath(), _TRUNCATE);
            PathRemoveFileSpec(m_szFolderPath);
        }

        if (!pMd5Item->IsNA())
        {
            TCHAR szSize[MAX_NUM_STR];
            NUMBERFMT nf;
            nf.NumDigits = 0;
            nf.LeadingZero = 0;
            nf.Grouping = 3;
            nf.lpDecimalSep = _T(".");
            nf.lpThousandSep = _T(",");
            nf.NegativeOrder = 1;
            _stprintf_s(szSize, MAX_NUM_STR, _T("%lld"), pMd5Item->GetSize());
            GetNumberFormat(LOCALE_USER_DEFAULT, 0, szSize, &nf, m_szSize, MAX_NUM_STR);

            TCHAR szDate[MAX_DATE_STR];
            TCHAR szTime[MAX_DATE_STR];
            SYSTEMTIME st;
            FileTimeToSystemTime(&pMd5Item->GetModified(), &st);
            GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, NULL, szDate, MAX_DATE_STR);
            GetTimeFormat(LOCALE_USER_DEFAULT, 0, &st, NULL, szTime, MAX_DATE_STR);
            _stprintf_s(m_szModified, MAX_DATE_STR, _T("%s %s"), szDate, szTime);
        }
        else
        {
            *m_szSize = 0;
            *m_szModified = 0;
        }
    }
}
开发者ID:feng1st,项目名称:md5checker,代码行数:43,代码来源:Md5ItemCached.cpp


示例12: GetLastError

UINT CSAStatusLog::Init(const TCHAR *pLogFilename)
{
	UINT ErrorCode;

	// get application path
	TCHAR szAppPath[MAX_PATH]={0};
	if (! GetModuleFileName(NULL,szAppPath,MAX_PATH))
	{
		return GetLastError();
	}

	// Call to "PathRemoveFileSpec". get app path.
	if (!PathRemoveFileSpec(szAppPath))
	{
		return GetLastError();
	}

	// Create Log Dir
	TCHAR szLogDir[MAX_PATH]={0};
	_stprintf_s(szLogDir,_T("%s\\Log"),szAppPath);

	BOOL rt = CreateDirectory(szLogDir,NULL);
	if (!rt && GetLastError() != 183)
	{
		int err = GetLastError();
		_tprintf(_T("Create directory %s error(%d).\r\n"),szLogDir,err);
		return err;
	}

	SYSTEMTIME sys; 
	GetLocalTime( &sys ); 
	_stprintf_s(m_szLogfile,_T("%s\\%s_%02d%02d%02d_%02d%02d.Log"),szLogDir,pLogFilename,sys.wYear,sys.wMonth,sys.wDay,sys.wHour,sys.wMinute);

	// create log file
	ErrorCode = CreateLogfile(m_hFile);
	if (ErrorCode)
	{
		return ErrorCode;
	}

	m_bEnable = TRUE;
	return 0;
}
开发者ID:gaozan198912,项目名称:myproject,代码行数:43,代码来源:SAStatusLog.cpp


示例13: wsprintf

BOOL CBatchRunBtn::OnSetLCID(DWORD dwLCID, HMODULE hInstance)
{
	TCHAR szLCID[20];
	wsprintf(szLCID, TEXT("%d"), dwLCID);
	BOOL ret = CTlbButton::OnSetLCID(dwLCID, hInstance);

	TCHAR langPath[MAX_PATH];
	LONG cbData = sizeof(langPath);
	RegQueryValue(HKEY_CLASSES_ROOT, TEXT("CLSID\\{FC712CA0-A945-11D4-A594-956F6349FC18}\\InprocServer32"), langPath, &cbData);
	PathRemoveFileSpec(langPath);
	PathAddBackslash(langPath);
	lstrcat(langPath, TEXT("langs\\"));
	lstrcat(langPath, szLCID);
	lstrcat(langPath, TEXT("\\batchrun.xml"));
	m_xui.clearStrings();
	m_xui.loadStrings(langPath);

	return ret;
}
开发者ID:truelaunchbar,项目名称:tlb-pdk-public,代码行数:19,代码来源:batchRunBtn.cpp


示例14: GetModuleFileName

bool CConfigIni::LoadConfig(LPCTSTR strIni)
{
	if(strIni == NULL)
	{
		TCHAR l_szIniPath[MAX_PATH] = {0};
		GetModuleFileName(AfxGetInstanceHandle(), l_szIniPath, MAX_PATH);
		PathRemoveFileSpec(l_szIniPath);
		PathAddBackslash(l_szIniPath);
		m_szPath = l_szIniPath;
		StrCat(l_szIniPath, l_szIniFilename);
		m_szIni = l_szIniPath;
	}
	else m_szIni = strIni;

	//节点名
	LoadString(l_szIniKey_Sys, l_szIniItem_Sys, m_szName);

	return LoadCurrentSystem();
}
开发者ID:Wanghuaichen,项目名称:SignalProcess,代码行数:19,代码来源:Base_AnalysisTemplate.cpp


示例15: InitializeEasyLogging

bool InitializeEasyLogging()
{
    char dll_path[MAX_PATH] = { '\0' };
    if (GetModuleFileName(dll_handle, dll_path, MAX_PATH) == 0)
        return false;
    PathRemoveFileSpec(dll_path);

    std::string mhud2_dir = std::string(dll_path);
    std::string conf_file = mhud2_dir + "/MHUD2.log.conf";
    std::string log_file = mhud2_dir + "/MHUD2.log";

    el::Configurations logger_conf(conf_file);
    logger_conf.setGlobally(el::ConfigurationType::Format, "[%datetime{%Y-%M-%d %h:%m:%s %F}] "
            "[TID: %thread] [%level] [HookDLL] %msg");
    logger_conf.setGlobally(el::ConfigurationType::Filename, log_file);
    logger_conf.setGlobally(el::ConfigurationType::ToFile, "true");

    el::Loggers::setDefaultConfigurations(logger_conf, true);
}
开发者ID:Blupi,项目名称:missinghud2,代码行数:19,代码来源:DllMain.cpp


示例16: wcscat_s

bool FileSystem::CreateRecursiveDirectory(const stringRef& filepath)
{
    bool result = false;
    wchar_t path_copy[MAX_PATH] = {0};
	wcscat_s(path_copy, MAX_PATH, filepath.str());
    std::vector<std::wstring> path_collection;

    for(int level=0; PathRemoveFileSpec(path_copy); level++)
    {
        path_collection.push_back(path_copy);
    }
    for(int i=path_collection.size()-1; i >= 0; i--)
    {
        if(!PathIsDirectory(path_collection[i].c_str()))
            if(CreateDirectory(path_collection[i].c_str(), NULL))
                result = true;
    }
    return result;
};
开发者ID:Iskander508,项目名称:doxygen_parser,代码行数:19,代码来源:FileSystem.cpp


示例17: RegisterShellMenu

void RegisterShellMenu(std::wstring opt, wchar_t* keyBaseName)
{
	// First, get the paths we will use

	wchar_t exePath[MAX_PATH] = { 0 };
	wchar_t icoPath[MAX_PATH] = { 0 };

	GetModuleFileName(NULL, exePath, sizeof(exePath));

	wchar_t commandStr[MAX_PATH + 20] = { 0 };
	swprintf_s(commandStr, L"\"%s\" \"%%V\"", exePath);

	// Now that we have `commandStr`, it's OK to change `exePath`...
	PathRemoveFileSpec(exePath);

	PathCombine(icoPath, exePath, L"icons\\cmder.ico");

	// Now set the registry keys

	HKEY root = GetRootKey(opt);

	HKEY cmderKey;
	FAIL_ON_ERROR(
		RegCreateKeyEx(root, keyBaseName, 0, NULL,
		REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &cmderKey, NULL));

	FAIL_ON_ERROR(RegSetValue(cmderKey, L"", REG_SZ, L"Cmder Here", NULL));
	FAIL_ON_ERROR(RegSetValueEx(cmderKey, L"NoWorkingDirectory", 0, REG_SZ, (BYTE *)L"", 2));

	FAIL_ON_ERROR(RegSetValueEx(cmderKey, L"Icon", 0, REG_SZ, (BYTE *)icoPath, wcslen(icoPath) * sizeof(wchar_t)));

	HKEY command;
	FAIL_ON_ERROR(
		RegCreateKeyEx(cmderKey, L"command", 0, NULL,
		REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &command, NULL));

	FAIL_ON_ERROR(RegSetValue(command, L"", REG_SZ, commandStr, NULL));

	RegCloseKey(command);
	RegCloseKey(cmderKey);
	RegCloseKey(root);
}
开发者ID:Claercio,项目名称:cmder,代码行数:42,代码来源:CmderLauncher.cpp


示例18: get_release_notes

static BOOL
get_release_notes(wchar_t rpath[MAX_PATH])
{
    BOOL rv  = FALSE;
    HKEY hk_client = NULL;
    wchar_t cpath[MAX_PATH];
    DWORD cb_data;

    if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
                     L"Software\\TransarcCorporation\\AFS Client\\CurrentVersion",
                     0, KEY_READ, &hk_client) != ERROR_SUCCESS)
        return FALSE;

    cb_data = sizeof(cpath);
    if (RegQueryValueEx(hk_client, L"PathName", NULL, NULL, (LPBYTE) cpath, &cb_data) != ERROR_SUCCESS)
        goto done;

    cpath[min(cb_data, MAX_PATH - 1)] = L'\0';

    if (!PathRemoveFileSpec(cpath))
        goto done;

    if (!PathAppend(cpath, L"Documentation"))
        goto done;

    if (!PathAppend(cpath, L"ReleaseNotes.chm"))
        goto done;

    if (!PathCanonicalize(rpath, cpath))
        goto done;

    if (!PathFileExists(rpath))
        goto done;

    rv = TRUE;

 done:
    if (hk_client)
        RegCloseKey(hk_client);

    return rv;
}
开发者ID:bagdxk,项目名称:openafs,代码行数:42,代码来源:afsicon.c


示例19: _tcscpy_s

ModelPtr XFileLoader::Open( const tstring& filePath,float scale )
{
	HRESULT hr = S_OK;

	m_fileName = filePath;

	TCHAR path[MAX_PATH];
	_tcscpy_s( path,MAX_PATH,filePath.c_str() );
	PathRemoveFileSpec( path );
	PathAddBackslash( path );
	m_path = path;

	m_scale = scale;

	Graphics* graphics = Graphics::GetInstance();
	IDirect3DDevice9Ptr pD3DDevice = graphics->GetDirect3DDevice();

	m_pAdjacencyBuf = NULL;
	m_pMaterialBuf = NULL;
	m_pEffectInstancesBuf = NULL;
	m_Materials = 0;
	m_pD3DMesh = NULL;

	ModelPtr pModel;

	hr = D3DXLoadMeshFromX(
		m_fileName.c_str(),
		D3DXMESH_SYSTEMMEM,
		pD3DDevice,
		&m_pAdjacencyBuf,
		&m_pMaterialBuf,
		&m_pEffectInstancesBuf,
		&m_Materials,
		&m_pD3DMesh );

	if( FAILED(hr) )
	{
		return ModelPtr();
	}

	return ModelPtr( new Model( CreateMeshContainer() ) );
}
开发者ID:ZeusAFK,项目名称:MikuMikuGameEngine,代码行数:42,代码来源:XFileLoader.cpp


示例20: NewVersionCallback

static void NewVersionCallback( DWORD newVersion, CString downloadUrl, CString news )
{
	if (newVersion>GetVersionEx(g_Instance))
	{
		wchar_t path[_MAX_PATH];
		GetModuleFileName(g_Instance,path,_countof(path));
		PathRemoveFileSpec(path);
		PathAppend(path,L"ClassicShellUpdate.exe");
		wchar_t cmdLine[1024];
		Sprintf(cmdLine,_countof(cmdLine),L"\"%s\" -popup",path);
		STARTUPINFO startupInfo={sizeof(startupInfo)};
		PROCESS_INFORMATION processInfo;
		memset(&processInfo,0,sizeof(processInfo));
		if (CreateProcess(path,cmdLine,NULL,NULL,TRUE,0,NULL,NULL,&startupInfo,&processInfo))
		{
			CloseHandle(processInfo.hThread);
			CloseHandle(processInfo.hProcess);
		}
	}
}
开发者ID:VonChenPlus,项目名称:ClassicShell,代码行数:20,代码来源:dllmain.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PathStrokeType函数代码示例发布时间:2022-05-30
下一篇:
C++ PathJoin函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap