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

C++ PathFindFileName函数代码示例

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

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



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

示例1: WSTRDupDynamic

HRESULT CDebugLog::SetProperties(IApplicationContext *pAppCtx)
{
    HRESULT                                  hr = S_OK;
    LPWSTR                                   wzAppName = NULL;

    // Get the executable name
    if (pAppCtx) {
        hr = ::AppCtxGetWrapper(pAppCtx, ACTAG_APP_NAME, &wzAppName);
        if (FAILED(hr)) {
            goto Exit;
        }
    }

    if (wzAppName && lstrlenW(wzAppName)) {
        _wzEXEName = WSTRDupDynamic(wzAppName);
        if (!_wzEXEName) {
            hr = E_OUTOFMEMORY;
            goto Exit;
        }
    }
    else {
        LPWSTR               wzFileName;

        // Didn't find EXE name in appctx. Use the .EXE name.
        wzFileName = PathFindFileName(g_wzEXEPath);
        _ASSERTE(wzFileName);

        _wzEXEName = WSTRDupDynamic(wzFileName);
        if (!_wzEXEName) {
            hr = E_OUTOFMEMORY;
            goto Exit;
        }
    }

Exit:
    SAFEDELETEARRAY(wzAppName);

    return hr;
}
开发者ID:Anupam-,项目名称:shared-source-cli-2.0,代码行数:39,代码来源:dbglog.cpp


示例2: LoadString

BOOL CMediaSettingsPage::OnInitDialog()
{
	CSettingsPage::OnInitDialog();

	m_bEnablePlay		= Settings.MediaPlayer.EnablePlay;
	m_bEnableEnqueue	= Settings.MediaPlayer.EnableEnqueue;

	for ( string_set::const_iterator i = Settings.MediaPlayer.FileTypes.begin();
		i != Settings.MediaPlayer.FileTypes.end(); ++i )
	{
		m_wndList.AddString( *i );
	}

	m_wndServices.AddString( L"(" + LoadString( IDS_GENERAL_CUSTOM ) + L"\x2026)" );
	m_wndServices.AddString( LoadString( IDS_MEDIA_PLAYER ) );
	int nSelected = INTERNAL_INDEX;

	for ( string_set::const_iterator i = Settings.MediaPlayer.ServicePath.begin();
		i != Settings.MediaPlayer.ServicePath.end(); ++i )
	{
		CString strPlayer = *i;
		BOOL bSelected = strPlayer.Right( 1 ) == L'*';	// SELECTED_PLAYER_TOKEN
		if ( bSelected ) strPlayer.TrimRight( L'*' );	// SELECTED_PLAYER_TOKEN

		int nIndex = m_wndServices.AddString( PathFindFileName( strPlayer ) );
		if ( bSelected )
			nSelected = nIndex;

		m_wndServices.SetItemDataPtr( nIndex, new CString( strPlayer ) );
	}

	m_wndServices.SetCurSel( nSelected );

	UpdateData( FALSE );

	Update();

	return TRUE;
}
开发者ID:GetEnvy,项目名称:Envy,代码行数:39,代码来源:PageSettingsMedia.cpp


示例3: GetModuleFileName

HRESULT CRegisterExtension::RegisterAppShortcutInSendTo() const
{
    WCHAR szPath[MAX_PATH];
    HRESULT hr = GetModuleFileName(NULL, szPath, ARRAYSIZE(szPath)) ? S_OK : ResultFromKnownLastError();
    if (SUCCEEDED(hr))
    {
        //  Set the shortcut target
        IShellLink *psl;
        hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&psl));
        if (SUCCEEDED(hr))
        {
            hr = psl->SetPath(szPath);
            if (SUCCEEDED(hr))
            {
                WCHAR szName[MAX_PATH];
                StringCchCopy(szName, ARRAYSIZE(szName), PathFindFileName(szPath));
                PathRenameExtension(szName, L".lnk");

                hr = SHGetFolderPath(NULL, CSIDL_SENDTO, NULL, 0, szPath);
                if (SUCCEEDED(hr))
                {
                    hr = PathAppend(szPath, szName) ? S_OK : E_FAIL;
                    if (SUCCEEDED(hr))
                    {
                        IPersistFile *ppf;
                        hr = psl->QueryInterface(IID_PPV_ARGS(&ppf));
                        if (SUCCEEDED(hr))
                        {
                            hr = ppf->Save(szPath, TRUE);
                            ppf->Release();
                        }
                    }
                }
            }
            psl->Release();
        }
    }
    return hr;
}
开发者ID:Ippei-Murofushi,项目名称:WindowsSDK7-Samples,代码行数:39,代码来源:RegisterExtension.cpp


示例4: PathFindFileName

void CCrossDlg::PopulateCombo(int Sel)
{
	CComboBox& Combo = (Sel == SEL_A ? m_NameA : m_NameB);
	CString	s;
	Combo.GetWindowText(s);
	Combo.ResetContent();
	int	i;
	for (i = 0; i < SELS; i++) {
		if (i != Sel) {	// exclude self-assignment
			int	pos = Combo.AddString(m_Frm->GetSelName(i));
			Combo.SetItemData(pos, i);	// store selection index in item
		}
	}
	int	Patches = m_Frm->GetPlaylist().GetCount();
	for (i = 0; i < Patches; i++) {
		CPathStr	Name;
		Name = PathFindFileName(m_Frm->GetPlaylist().GetPath(i));
		Name.RemoveExtension();
		Combo.AddString(Name);
	}
	Combo.SetWindowText(s);
}
开发者ID:fdiskcn,项目名称:Whorld,代码行数:22,代码来源:CrossDlg.cpp


示例5: fileSaveForce

BOOL fileSaveForce(PSTR szName,PSTR szTempName,PBYTE pData,DWORD cbData)
{
  char  szTemp[_MAX_PATH];
  char  szData[8192];
  DWORD dwType,dwData;
  HKEY  hKey;
  PSTR  pFrom,pTo;
  char  szFrom[_MAX_PATH];
  char  szTo[_MAX_PATH];
 
  //try normal save
  if (fileSave(szName,pData,cbData)) return TRUE;
  //use MOVEFILE_DELAY_UNTIL_REBOOT
  strcpy(szTemp,szName);
  strcpy(PathFindFileName(szTemp),szTempName);
  if (!fileSave(szTemp,pData,cbData)) return FALSE;
  //check if MoveFileEx need ?
  if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\Session Manager",0,KEY_READ,&hKey)){
    dwData = sizeof(szData);
    RegQueryValueEx(hKey,"PendingFileRenameOperations",NULL,&dwType,(PBYTE)szData,&dwData);
    RegCloseKey(hKey);

	strcpy(szFrom,szTemp);
	strcpy(szTo,szName);

	strlwr(szFrom);
	strlwr(szTo);
    
	for(pFrom=szData;pFrom<szData+dwData;){
	  pTo   = pFrom + 1 + strlen(pFrom);
	  strlwr(pFrom);
	  strlwr(pTo);
	  if (NULL != strstr(pFrom,szFrom) && NULL != strstr(pTo,szTo)) return TRUE;
	  pFrom = pTo + 1 + strlen(pTo);
    }
  }
  return MoveFileEx(szTemp,szName,MOVEFILE_DELAY_UNTIL_REBOOT);
}
开发者ID:cirosantilli,项目名称:netWork-fork,代码行数:38,代码来源:fileLib.c


示例6: PathCombine

string AppSettings::FindImage(const string& fname){
   TCHAR buffer[MAX_PATH];

   // Simply check for fully qualified path
   if (PathIsRoot(fname.c_str())) {
      if (-1 != _taccess(fname.c_str(), 0))
         return fname;
   }

   // Test if its relative and in one of the specified root paths
   for (stringlist::iterator itr = textureRootPaths.begin(), end = textureRootPaths.end(); itr != end; ++itr ){
      PathCombine(buffer, itr->c_str(), fname.c_str());
      if (-1 != _taccess(buffer, 0)){
         return string(buffer);
      }
   }

   // Hit the directories to find out whats out there
   if (!parsedImages){
      FindImages(imgTable, rootPath, searchPaths, extensions);
      parsedImages = true;
   }
   
   // Search my filename for our texture
   _tcscpy(buffer, PathFindFileName(fname.c_str()));
   PathRemoveExtension(buffer);
   NameValueCollection::iterator itr = imgTable.find(buffer);
   if (itr != imgTable.end()){
      if (!rootPath.empty()) {
         _tcscpy(buffer, rootPath.c_str());
         PathCombine(buffer, rootPath.c_str(), ((*itr).second).c_str());
         return string(buffer);
      } else {
         return (*itr).second;
      }
   }
   return fname;
}
开发者ID:CruxAnsata,项目名称:max_nif_plugin,代码行数:38,代码来源:AppSettings.cpp


示例7: ASSERT

bool CCrossDlg::Open(int Sel, LPCTSTR Path)
{
	ASSERT(Sel >= 0 && Sel < SELS);
	if (!SaveCheck(Sel))
		return(FALSE);
	CStdioFile	fp;
	CFileException	e;
	if (!fp.Open(Path, CFile::modeRead | CFile::shareDenyWrite, &e)) {
		e.ReportError();
		return(FALSE);
	}
	CPatch	Patch;
	if (!Patch.Read(fp))
		return(FALSE);
	m_Info[Sel] = Patch;
	UpdateMix(m_PosEdit.GetVal());
	CPathStr	FileName(PathFindFileName(Path));
	FileName.RemoveExtension();
	SetName(Sel, FileName);
	if (Sel == m_Frm->GetEditSel())	// if input is selected for editing
		m_Frm->SetEditSel(Sel);	// refresh parameters dialog
	return(TRUE);
}
开发者ID:fdiskcn,项目名称:Whorld,代码行数:23,代码来源:CrossDlg.cpp


示例8: MakeExpandInformationEx

//UtilExpandTemplateString()のパラメータ展開に必要な情報を構築する
void MakeExpandInformationEx(std::map<stdString,CString> &envInfo,LPCTSTR lpOpenDir,LPCTSTR lpOutputFile)
{
	//環境変数で構築
	UtilMakeExpandInformation(envInfo);

	//変数登録
	if(lpOpenDir){
		envInfo[_T("dir")]=lpOpenDir;
		envInfo[_T("OutputDir")]=lpOpenDir;

		//出力ドライブ名
		TCHAR szBuffer[MAX_PATH+1];
		_tcsncpy_s(szBuffer,lpOpenDir,COUNTOF(szBuffer)-1);
		PathStripToRoot(szBuffer);
		if(szBuffer[_tcslen(szBuffer)-1]==L'\\')szBuffer[_tcslen(szBuffer)-1]=L'\0';
		envInfo[_T("OutputDrive")]=(LPCTSTR)szBuffer;
	}

	if(lpOutputFile){
		envInfo[_T("OutputFile")]=lpOutputFile;
		envInfo[_T("OutputFileName")]=PathFindFileName(lpOutputFile);
	}
}
开发者ID:Claybird,项目名称:lhaforge,代码行数:24,代码来源:CommonUtil.cpp


示例9: GetDirectoryAndFileName

void
GetDirectoryAndFileName(const std::string &currentDirectory, 
                        const std::string &relativeName,
                        std::string *directory, std::string *filename) {
#ifdef ISPC_IS_WINDOWS
    char path[MAX_PATH];
    const char *combPath = PathCombine(path, currentDirectory.c_str(),
                                       relativeName.c_str());
    assert(combPath != NULL);
    const char *filenamePtr = PathFindFileName(combPath);
    *filename = filenamePtr;
    *directory = std::string(combPath, filenamePtr - combPath);
#else
    // We need a fully qualified path.  First, see if the current file name
    // is fully qualified itself--in that case, the current working
    // directory isn't needed.  
    // @todo This probably needs to be smarter for Windows...
    std::string fullPath;
    if (relativeName[0] == '/')
        fullPath = relativeName;
    else {
        fullPath = g->currentDirectory;
        if (fullPath[fullPath.size()-1] != '/')
            fullPath.push_back('/');
        fullPath += relativeName;
    }

    // now, we need to separate it into the base name and the directory
    const char *fp = fullPath.c_str();
    const char *basenameStart = strrchr(fp, '/');
    assert(basenameStart != NULL);
    ++basenameStart;
    assert(basenameStart != '\0');
    *filename = basenameStart;
    *directory = std::string(fp, basenameStart - fp);
#endif // ISPC_IS_WINDOWS
}
开发者ID:ngaloppo,项目名称:ispc,代码行数:37,代码来源:util.cpp


示例10: lstrcpy

/*-----------------------------------------------------------------------------
-----------------------------------------------------------------------------*/
void CWinPCap::Initialize(void) {
  if (!LoadWinPCap()) {
    TCHAR path[MAX_PATH];
    if (GetModuleFileName(NULL, path, _countof(path))) {
      lstrcpy(PathFindFileName(path), _T("winpcap-nmap-4.12.exe"));
      CString exe(path);
      CString cmd = CString(_T("\"")) + exe + _T("\" /S");

      PROCESS_INFORMATION pi;
      STARTUPINFO si;
      memset( &si, 0, sizeof(si) );
      si.cb = sizeof(si);
      si.dwFlags = STARTF_USESHOWWINDOW;
      si.wShowWindow = SW_HIDE;
      if (CreateProcess((LPCTSTR)exe, (LPTSTR)(LPCTSTR)cmd, 0, 0, FALSE, 
          IDLE_PRIORITY_CLASS , 0, NULL, &si, &pi)) {
        WaitForSingleObject(pi.hProcess, 60 * 60 * 1000);
        CloseHandle(pi.hThread);
        CloseHandle(pi.hProcess);
      }
    }
    LoadWinPCap();
  }
}
开发者ID:AceMood,项目名称:webpagetest,代码行数:26,代码来源:WinPCap.cpp


示例11: time

void Logger::StartLog()
{
	time_t rawtime;
	tm timeinfo;
	time(&rawtime);
	localtime_s(&timeinfo, &rawtime);
	timeinfo.tm_mon++;
	timeinfo.tm_year += 1900;


	TCHAR modulePath[MAX_PATH];
	TCHAR * moduleName;
	GetModuleFileName(NULL, modulePath, MAX_PATH);
	moduleName = PathFindFileName(modulePath);
	*(PathFindExtension(moduleName)) = 0;

	// Log to TextFiles
	char logFile[MAX_PATH];
	std::string logs_dir(".\\Logs");
	MAKEDIR(logs_dir.c_str());
	sprintf_s(logFile, "%s\\%s_%02d-%02d-%04d.txt", logs_dir.c_str(), moduleName, timeinfo.tm_mday, timeinfo.tm_mon, timeinfo.tm_year);

	std::ofstream fsLog(logFile, std::ios::app);
	if (fsLog.is_open())
	{
		char timeData[MAX_PATH];
		sprintf_s(timeData, "%02d:%02d:%02d %02d-%02d-%04d", timeinfo.tm_hour, timeinfo.tm_min, timeinfo.tm_sec, timeinfo.tm_mday, timeinfo.tm_mon, timeinfo.tm_year);
		fsLog << "=============================================================================================" << std::endl;
		fsLog << "===\t\t\t\tLOG START " << timeData << "\t\t\t\t  ===" << std::endl;
		fsLog << "=============================================================================================" << std::endl;
		fsLog.close();
	}

	Log("%s - Dragon Ball Online Server\n", moduleName);
	SetConsoleTitle(moduleName);
}
开发者ID:ChowZenki,项目名称:dboserver,代码行数:36,代码来源:Logger.cpp


示例12: sizeof

void CReadChangesRequest::ProcessNotification()
{
	BYTE* pBase = m_BackupBuffer.data();

	for (;;)
	{
		FILE_NOTIFY_INFORMATION& fni = (FILE_NOTIFY_INFORMATION&)*pBase;

		std::wstring wstrFilename = fni.FileName; // , fni.FileNameLength / sizeof(wchar_t));
		//wstrFilename[fni.FileNameLength] = 0;
		// Handle a trailing backslash, such as for a root directory.
		if (m_wstrDirectory[m_wstrDirectory.length()-1] != L'\\')
			wstrFilename = m_wstrDirectory + L'\\' + wstrFilename;
		else
			wstrFilename = m_wstrDirectory + wstrFilename;

		// If it could be a short filename, expand it.
		LPCWSTR wszFilename = PathFindFileName(wstrFilename.c_str());
		int len = lstrlen(wszFilename);
		// The maximum length of an 8.3 filename is twelve, including the dot.
		if (len <= 12 && wcschr(wszFilename, L'~'))
		{
			// Convert to the long filename form. Unfortunately, this
			// does not work for deletions, so it's an imperfect fix.
			wchar_t wbuf[MAX_PATH];
			if (::GetLongPathName(wstrFilename.c_str(), wbuf, _countof(wbuf)) > 0)
				wstrFilename = wbuf;
		}

		m_pServer->m_pBase->Push(fni.Action, wstrFilename);

		if (!fni.NextEntryOffset)
			break;
		pBase += fni.NextEntryOffset;
	};
}
开发者ID:alhunor,项目名称:projects,代码行数:36,代码来源:ReadDirectoryChangesPrivate.cpp


示例13: mirGetFileTitle

MBASEAPI LPCTSTR MIRACLEEXPORT mirGetFileTitle(LPCTSTR lpszPath)
{	
	return PathFindFileName(lpszPath);	
}
开发者ID:hozgur,项目名称:Colorway,代码行数:4,代码来源:globalfunctions.cpp


示例14: showContextMenu

BOOL showContextMenu (HWND hDlg, TCHAR* FName, WNDPROC menuProc)
{
	TCHAR* FileName = PathFindFileName (FName);
	TCHAR FilePath [MAX_PATH];
	lstrcpy (FilePath, FName);
	*PathFindFileName (FilePath) = L'\0';
	
	LPSHELLFOLDER DesktopFolder;
	if (NOERROR != SHGetDesktopFolder (&DesktopFolder))
	{
		return FALSE;
	}
	
	LPITEMIDLIST ParentPidl;
	ULONG Eaten;
	if (S_OK != DesktopFolder->ParseDisplayName (hDlg, 0, FilePath, &Eaten, &ParentPidl, 0))
	{
		return FALSE;
	}
	
	LPSHELLFOLDER ParentFolder;
	if (S_OK != DesktopFolder->BindToObject (ParentPidl, 0, IID_IShellFolder, (void**)&ParentFolder))
	{
		return FALSE;
	}
	
	LPITEMIDLIST Pidl;
	if (S_OK != ParentFolder->ParseDisplayName (hDlg, 0, FileName, &Eaten, &Pidl, 0))
	{
		return FALSE;
	}	

	LPCONTEXTMENU CM;
	if (S_OK != ParentFolder->GetUIObjectOf (hDlg, 1, (LPCITEMIDLIST*)&Pidl, IID_IContextMenu, 0, (void**)&CM))
	{
		return FALSE;
	}
	
	HMENU hMenu = CreatePopupMenu ();
	if (hMenu == NULL) 
	{
		return FALSE;
	}
	
	CM->QueryContextMenu (hMenu, 0, 1, 0x7FFF, CMF_EXTENDEDVERBS | CMF_EXPLORE);
	
	WNDPROC defWndProc = (WNDPROC) SetWindowLong (hDlg, GWL_WNDPROC, (LONG)menuProc);
	SetProp (hDlg, L"defWndProc", (HANDLE) defWndProc);
	
	POINT pt;
	GetCursorPos (&pt);
	int Cmd = TrackPopupMenu (hMenu,
		TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_RETURNCMD,
		pt.x, pt.y, 0, hDlg, 0);


	SetWindowLong (hDlg, GWL_WNDPROC, (LONG) RemoveProp (hDlg, L"defWndProc"));
		
	if (Cmd)
	{
		// Set up a CMINVOKECOMMANDINFO structure.
		CMINVOKECOMMANDINFO CI;
		ZeroMemory (&CI, sizeof(CMINVOKECOMMANDINFO));
		CI.cbSize = sizeof (CMINVOKECOMMANDINFO);
		CI.hwnd = hDlg;
		CI.lpVerb = (LPCSTR) MAKEINTRESOURCE(Cmd - 1);
		CI.lpParameters = "";
		CI.lpDirectory = "";
		CI.nShow = SW_SHOWNORMAL;
		CM->InvokeCommand (&CI);
	}
	
	return DestroyMenu (hMenu);
}
开发者ID:shasa2013,项目名称:fileman,代码行数:74,代码来源:context.cpp


示例15: _tmain

int _tmain(int argc, _TCHAR* argv[])
{
	if ( argc < 4 )
	{
		_tprintf( _T("SkinUpdate ") _VERSION_
			_T("\nUsage: SkinUpdate.exe input.h input.rc output.xml\n") );
		return 1;
	}

	LPCTSTR szOutput = NULL;

	for ( int i = 1 ; i < argc ; i++ )
	{
		LPCTSTR szFilename = PathFindFileName( argv[ i ] );
		LPCTSTR szExt = PathFindExtension( szFilename );
		if ( _tcscmp( szExt, _T(".h") ) == 0 )
		{
			if ( ! LoadIDs( argv[ i ] ) )
			{
				_tprintf( _T("Error: Filed to load IDs from: %s\n"), szFilename );
				return 1;
			}
			_tprintf(
				_T("Loaded from %s:\n")
				_T("  %d IDs\n"),
				szFilename, g_oIDs.GetCount() );
		}
		else if ( _tcscmp( szExt, _T(".rc") ) == 0 )
		{
			if ( ! LoadResources( argv[ i ] ) )
			{
				_tprintf( _T("Error: Filed to load strings from: %s\n"), szFilename );
				return 1;
			}
			_tprintf(
				_T("Loaded from %s:\n")
				_T("  %d strings\n")
				_T("  %d guidelines\n")
				_T("  %d dialogs\n")
				_T("  %d icons\n")
				_T("  %d bitmaps\n")
				_T("  %d htmls\n"),
				szFilename,
				g_oStrings.GetCount(),
				g_oGuidelines.GetCount(),
				g_oDialogs.GetCount(),
				g_oIcons.GetCount(),
				g_oBitmaps.GetCount(),
				g_oHtmls.GetCount() );
		}
		else if ( _tcscmp( szExt, _T(".xml") ) == 0 )
		{
			szOutput = argv[ i ];
		}
		else
		{
			_tprintf( _T("Error: Unknown file extension: %s\n"), szExt );
			return 1;
		}
	}

	for ( POSITION pos = g_oDialogs.GetStartPosition() ; pos ; )
	{
		CStringA sID;
		UINT nID;
		g_oDialogs.GetNextAssoc( pos, sID, nID );

		if ( ! g_oGuidelines.Lookup( sID, nID ) )
			_tprintf( _T("Warning: Found dialog \"%hs\" without guideline\n"), sID );
	}

	for ( POSITION pos = g_oIDs.GetStartPosition() ; pos ; )
	{
		CStringA sID;
		UINT nID;
		g_oIDs.GetNextAssoc( pos, sID, nID );

		if ( _strnicmp( sID, "IDI_", 4 ) == 0 )
		{
			UINT nFoo;
			if ( ! g_oIcons.Lookup( sID, nFoo ) )
				_tprintf( _T("Warning: Found orphan icon ID \"%hs\"\n"), sID );
		}
		else if ( _strnicmp( sID, "IDR_", 4 ) == 0 )
		{
			UINT nFoo;
			if ( ! g_oBitmaps.Lookup( sID, nFoo ) &&
				 ! g_oIcons.Lookup( sID, nFoo ) &&
				 ! g_oHtmls.Lookup( sID, nFoo ) )
			{
				_tprintf( _T("Warning: Found orphan bitmap/icon/html ID \"%hs\"\n"), sID );
			}
		}
		else if ( _strnicmp( sID, "IDB_", 4 ) == 0 )
		{
			UINT nFoo;
			if ( ! g_oBitmaps.Lookup( sID, nFoo ) )
				_tprintf( _T("Warning: Found orphan bitmap ID \"%hs\"\n"), sID );
		}
		else if ( _strnicmp( sID, "IDD_", 4 ) == 0 )
//.........这里部分代码省略.........
开发者ID:lemonxiao0,项目名称:peerproject,代码行数:101,代码来源:SkinExtract.cpp


示例16: switch

INT_PTR CALLBACK CDialogPackage::SelectFolderDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg)
    {
    case WM_INITDIALOG:
    {
        EnableThemeDialogTexture(hWnd, ETDT_ENABLETAB);
        c_Dialog->SetDialogFont(hWnd);

        std::wstring* existingPath = (std::wstring*)lParam;
        SetWindowLongPtr(hWnd, GWLP_USERDATA, lParam);

        *existingPath += L'*';
        WIN32_FIND_DATA fd;
        HANDLE hFind = FindFirstFileEx(existingPath->c_str(), FindExInfoStandard, &fd, FindExSearchNameMatch, NULL, 0);
        existingPath->pop_back();

        if (hFind != INVALID_HANDLE_VALUE)
        {
            const WCHAR* folder = PathFindFileName(existingPath->c_str());

            HWND item = GetDlgItem(hWnd, IDC_PACKAGESELECTFOLDER_EXISTING_RADIO);
            std::wstring text = L"Add folder from ";
            text.append(folder, wcslen(folder) - 1);
            text += L':';
            SetWindowText(item, text.c_str());
            Button_SetCheck(item, BST_CHECKED);

            item = GetDlgItem(hWnd, IDC_PACKAGESELECTFOLDER_EXISTING_COMBO);

            do
            {
                if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY &&
                        !(fd.cFileName[0] == L'.' && (!fd.cFileName[1] || fd.cFileName[1] == L'.' && !fd.cFileName[2])) &&
                        wcscmp(fd.cFileName, L"Backup") != 0 &&
                        wcscmp(fd.cFileName, L"@Backup") != 0)
                {
                    ComboBox_InsertString(item, -1, fd.cFileName);
                }
            }
            while (FindNextFile(hFind, &fd));

            ComboBox_SetCurSel(item, 0);

            FindClose(hFind);
        }
    }
    break;

    case WM_COMMAND:
        switch (LOWORD(wParam))
        {
        case IDC_PACKAGESELECTFOLDER_EXISTING_RADIO:
        {
            HWND item = GetDlgItem(hWnd, IDC_PACKAGESELECTFOLDER_EXISTING_COMBO);
            EnableWindow(item, TRUE);
            int sel = ComboBox_GetCurSel(item);
            item = GetDlgItem(hWnd, IDC_PACKAGESELECTFOLDER_CUSTOM_EDIT);
            EnableWindow(item, FALSE);
            item = GetDlgItem(hWnd, IDC_PACKAGESELECTFOLDER_CUSTOMBROWSE_BUTTON);
            EnableWindow(item, FALSE);

            item = GetDlgItem(hWnd, IDOK);
            EnableWindow(item, sel != -1);
        }
        break;

        case IDC_PACKAGESELECTFOLDER_CUSTOM_RADIO:
        {
            HWND item = GetDlgItem(hWnd, IDC_PACKAGESELECTFOLDER_EXISTING_COMBO);
            EnableWindow(item, FALSE);
            item = GetDlgItem(hWnd, IDC_PACKAGESELECTFOLDER_CUSTOM_EDIT);
            EnableWindow(item, TRUE);
            item = GetDlgItem(hWnd, IDC_PACKAGESELECTFOLDER_CUSTOMBROWSE_BUTTON);
            EnableWindow(item, TRUE);

            SendMessage(hWnd, WM_COMMAND, MAKEWPARAM(IDC_PACKAGESELECTFOLDER_CUSTOM_EDIT, EN_CHANGE), 0);
        }
        break;

        case IDC_PACKAGESELECTFOLDER_CUSTOM_EDIT:
            if (HIWORD(wParam) == EN_CHANGE)
            {
                WCHAR buffer[MAX_PATH];
                int len = Edit_GetText((HWND)lParam, buffer, MAX_PATH);

                // Disable Add button if invalid directory
                DWORD attributes = GetFileAttributes(buffer);
                BOOL state = (attributes != INVALID_FILE_ATTRIBUTES &&
                              attributes & FILE_ATTRIBUTE_DIRECTORY);
                EnableWindow(GetDlgItem(hWnd, IDOK), state);
            }
            break;

        case IDC_PACKAGESELECTFOLDER_CUSTOMBROWSE_BUTTON:
        {
            WCHAR buffer[MAX_PATH];
            BROWSEINFO bi = {0};
            bi.hwndOwner = hWnd;
            bi.ulFlags = BIF_USENEWUI | BIF_NONEWFOLDERBUTTON | BIF_RETURNONLYFSDIRS;
//.........这里部分代码省略.........
开发者ID:jieah,项目名称:rainmeter,代码行数:101,代码来源:DialogPackage.cpp


示例17: __declspec

extern "C" __declspec(dllexport) bool PinToStartMenu4XP(bool bPin, char* szPath)
{
	TSAUTO();

	TCHAR file_dir[MAX_PATH + 1] = {0};
	TCHAR *file_name;
	wchar_t* pwstr_Path = AnsiToUnicode(szPath);
	if(pwstr_Path == NULL){
		return false;
	}

	wcscpy_s(file_dir,MAX_PATH,pwstr_Path);
	PathRemoveFileSpecW(file_dir);
	file_name = PathFindFileName(pwstr_Path);
	::CoInitialize(NULL);
	CComPtr<IShellDispatch> pShellDisp;
	CComPtr<Folder> folder_ptr;
	CComPtr<FolderItem> folder_item_ptr;
	CComPtr<FolderItemVerbs> folder_item_verbs_ptr;


	HRESULT rv = CoCreateInstance( CLSID_Shell, NULL, CLSCTX_SERVER,IID_IDispatch, (LPVOID *) &pShellDisp );
	do 
	{
		IF_FAILED_OR_NULL_BREAK(rv,pShellDisp);
		rv = pShellDisp->NameSpace(_variant_t(file_dir),&folder_ptr);
		IF_FAILED_OR_NULL_BREAK(rv,folder_ptr);
		rv = folder_ptr->ParseName(CComBSTR(file_name),&folder_item_ptr);
		IF_FAILED_OR_NULL_BREAK(rv,folder_item_ptr);
		rv = folder_item_ptr->Verbs(&folder_item_verbs_ptr);
		IF_FAILED_OR_NULL_BREAK(rv,folder_item_verbs_ptr);
		long count = 0;
		folder_item_verbs_ptr->get_Count(&count);
		for (long i = 0; i < count ; ++i)
		{
			FolderItemVerb* item_verb = NULL;
			rv = folder_item_verbs_ptr->Item(_variant_t(i),&item_verb);
			if (SUCCEEDED(rv) && item_verb)
			{
				CComBSTR bstrName;
				item_verb->get_Name(&bstrName);

				if ( VerbNameMatch(bstrName,bPin) )
				{
					TSDEBUG4CXX("Find Verb to Pin:"<< bstrName);
					int i = 0;
					do
					{
						rv = item_verb->DoIt();
						TSDEBUG4CXX("Try Do Verb. NO." << i+1 << ", return="<<rv);
						if (SUCCEEDED(rv))
						{
							::SHChangeNotify(SHCNE_UPDATEDIR|SHCNE_INTERRUPT|SHCNE_ASSOCCHANGED, SHCNF_IDLIST |SHCNF_FLUSH | SHCNF_PATH|SHCNE_ASSOCCHANGED,
								pwstr_Path,0);
							Sleep(500);
							delete [] pwstr_Path;
							::CoUninitialize();
							return true;
						}else
						{
							Sleep(500);
							rv = item_verb->DoIt();
						}
					}while ( i++ < 3);
						
					break;
				}
			}
		}
	} while (0);
	delete [] pwstr_Path;
	::CoUninitialize();
	return false;
}
开发者ID:fanliaokeji,项目名称:lvdun,代码行数:74,代码来源:dllmain.cpp


示例18: Import

DWORD WINAPI Import(LPVOID lpParameter)
{
    BOOL   bIsDirectory;
    CHAR   szFileName[MAX_PATH];
    PBYTE  pbFile;
    LPSTR  lpPath, lpFileName;
    HANDLE hFile, hMap, hFind;
    DWORD  dwFileAttributes, dwSize, dwNewSize, dwCount, dwTotal;
    FILETYPE FileType;
    WIN32_FIND_DATA wfd;

    lpPath = (LPSTR)lpParameter;
    dwNewSize = dwCount = dwTotal = 0;
    dwFileAttributes = GetFileAttributes(lpPath);
    if (dwFileAttributes == INVALID_FILE_ATTRIBUTES)
    {
        return 0;
    }

    bIsDirectory = dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
    if (bIsDirectory)
    {
        sprintf(szFileName, "%s\\*.*", lpPath);
        hFind = FindFirstFile(szFileName, &wfd);
        if (hFind == INVALID_HANDLE_VALUE)
        {
            return 0;
        }
        lpFileName = szFileName;
    }
    else
    {
        lpFileName = lpPath;
    }

    while (ReleaseSemaphore(g_hSemaphore, 1, NULL) == FALSE)
    {
        Sleep(1);
    }

    do
    {
        if (bIsDirectory)
        {
            if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
            {
                continue;
            }
            sprintf(szFileName, "%s\\%s", lpPath, wfd.cFileName);
        }

        ++dwTotal;
        hFile = CreateFile(FILE_NAME,
                           GENERIC_READ|GENERIC_WRITE,
                           FILE_SHARE_READ|FILE_SHARE_WRITE,
                           NULL,
                           OPEN_EXISTING,
                           FILE_ATTRIBUTE_NORMAL,
                           NULL);
        if (hFile == INVALID_HANDLE_VALUE)
        {
            printf("CreateFile() failed: %s\n", FILE_NAME);
            continue;
        }

        dwSize = GetFileSize(hFile, NULL);

        if (dwSize != 0)
        {
            hMap = CreateFileMapping(hFile, NULL, PAGE_READWRITE, 0, dwSize, NULL);
            if (hMap == NULL)
            {
                printf("CreateFileMapping() failed: %s\n", FILE_NAME);
                CloseHandle(hFile);
                continue;
            }

            pbFile = (PBYTE)MapViewOfFile(hMap, FILE_MAP_ALL_ACCESS, 0, 0, 0);
            CloseHandle(hMap);
            if (pbFile == NULL)
            {
                printf("MapViewOfFile() failed: %s\n", FILE_NAME);
                CloseHandle(hFile);
                continue;
            }

            FileType = CheckFileType(pbFile, dwSize, PathFindFileName(FILE_NAME));
            if (FileType != UNKNOWN)
            {
                ReplaceString(pbDict, pbFile, dwSize);
                dwNewSize = StringToAnsi(pbFile, FileType, dwSize);
                ++dwCount;
            }

            UnmapViewOfFile(pbFile);
            if (dwNewSize != 0)
            {
                SetFilePointer(hFile, dwNewSize, 0, FILE_BEGIN);
                SetEndOfFile(hFile);
            }
//.........这里部分代码省略.........
开发者ID:QuocHuy7a10,项目名称:Arianrhod,代码行数:101,代码来源:3rdText.cpp


示例19: D_TryGetWad

dboolean D_TryGetWad(const char* name)
{
#ifndef __CELLOS_LV2__
  dboolean result = false;

  char wadname[PATH_MAX];
  char* cmdline = NULL;
  char* wadname_p = NULL;
  char* msg = NULL;
  const char* format =
    "The necessary wad has not been found\n"
    "Do you want to search for \'%s\'?\n\n"
    "Command line:\n%s\n\n"
    "Be careful! Execution of an unknown program is unsafe.";

  if (!getwad_cmdline || !name || !(*getwad_cmdline) || !(*name))
    return false;

  strncpy(wadname, PathFindFileName(name), sizeof(wadname) - 4);
  AddDefaultExtension(wadname, ".wad");

  cmdline = malloc(strlen(getwad_cmdline) + strlen(wadname) + 2);
  wadname_p = strstr(getwad_cmdline, "%wadname%");
  if (wadname_p)
  {
    strncpy(cmdline, getwad_cmdline, wadname_p - getwad_cmdline);
    strcat(cmdline, wadname);
    strcat(cmdline, wadname_p + strlen("%wadname%"));
  }
  else
  {
    sprintf(cmdline, "%s %s", getwad_cmdline, wadname);
  }

  msg = malloc(strlen(format) + strlen(wadname) + strlen(cmdline));
  sprintf(msg, format, wadname, cmdline);

  if (PRB_IDYES == I_MessageBox(msg, PRB_MB_DEFBUTTON2 | PRB_MB_YESNO))
  {
    int ret;

    lprintf(LO_INFO, "D_TryGetWad: Trying to get %s from somewhere\n", name);

    ret = system(cmdline);

    if (ret != 0)
    {
      lprintf(LO_ERROR, "D_TryGetWad: Execution failed - %s\n", strerror(errno));
    }
    else
    {
      char *str = I_FindFile(name, ".wad");
      if (str)
      {
        lprintf(LO_INFO, "D_TryGetWad: Successfully received\n");
        free(str);
        result = true;
      }
    }
  }

  free(msg);
  free(cmdline);

  return result;
#else
  return false;
#endif
}
开发者ID:twinaphex,项目名称:sdcell,代码行数:69,代码来源:r_demo.c


示例20: InstallService

//
//   FUNCTION: InstallService
//
//   PURPOSE: Install the current application as a service to the local 
//   service control manager database.
//
//   PARAMETERS:
//   * pszServiceName - the name of the service to be installed
//   * pszDisplayName - the display name of the service
//   * dwStartType - the service start option. This parameter can be one of 
//     the following values: SERVICE_AUTO_START, SERVICE_BOOT_START, 
//     SERVICE_DEMAND_START, SERVICE_DISABLED, SERVICE_SYSTEM_START.
//   * pszDependencies - a pointer to a double null-terminated array of null-
//     separated names of services or load ordering groups that the system 
//     must start before this service.
//   * pszAccount - the name of the account under which the service runs.
//   * pszPassword - the password to the account name.
//
//  RETURN VALUE:
//    TRUE if the service is successfully created, otherwise FALSE
//
//   NOTE: If the function fails to install the service, it prints the error 
//   in the standard output stream for users to diagnose the problem.
//
BOOL InstallService(PSTR pszServiceName, 
                    PSTR pszDisplayName, 
                    DWORD dwStartType,
                    PSTR pszDependencies, 
                    PSTR pszAccount, 
                    PSTR pszPassword)
{
    BOOL bRet = TRUE;
    char szPath[MAX_PATH];
	char outPath[MAX_PATH];
    SC_HANDLE schSCManager = NULL;
    SC_HANDLE schService = NULL;

	DBGPrint("Called\n");


	// Open the local default service control manager database, we do this first to see
	// if we're going to be even able to install
	schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT |
		SC_MANAGER_CREATE_SERVICE);
	if (schSCManager == NULL)
	{
		DBGPrint("OpenSCManager failed w/err 0x%08lx\n", GetLastError());
		goto Cleanup;
	}


    if (GetModuleFileName(NULL, szPath, ARRAYSIZE(szPath)) == 0)
    {
        DBGPrint("GetModuleFileName failed w/err 0x%08lx\n", GetLastError());
        goto Cleanup;
    }
	DBGPrint("File is: %s\n", szPath);

	//Copy the file to win32 or syswow64, depending on bitness
		//Get windows system directory
		 GetSystemDirectory(outPath, MAX_PATH);
	
		 PTSTR filename = PathFindFileName(szPath);
		 //Set up the path
		 strcat(outPath, "\\");
		 strcat(outPath, filename);

		 DBGPrint("Outfile is: %s\n",outPath);

		 //Copy the file
		 if (CopyFile(szPath, outPath, TRUE) == FALSE){
			 DWORD dwError = GetLastError();
			 DBGPrint("Copyfile failed w/err 0x%08lx\n", dwError);
			 if (dwError != ERROR_FILE_EXISTS){
				 goto Cleanup;
			 }
			 DBGPrint("File exists, lets install anyway\n");
		 }


    // Install the service into SCM by calling CreateService
    schService = CreateService(
        schSCManager,                   // SCManager database
        pszServiceName,                 // Name of service
        pszDisplayName,                 // Name to display
        SERVICE_QUERY_STATUS,           // Desired access
        SERVICE_WIN32_OWN_PROCESS,      // Service type
        dwStartType,                    // Service start type
        SERVICE_ERROR_NORMAL,           // Error control type
        szPath,                         // Service's binary
        NULL,                           // No load ordering group
        NULL,                           // No tag identifier
        pszDependencies,                // Dependencies
       // pszAccount,                     // Service running account
       NULL,       
       pszPassword                     // Password of the account
        );
    if (schService == NULL)
    {
        DBGPrint("CreateService failed w/err 0x%08lx\n", GetLastError());
//.........这里部分代码省略.........
开发者ID:MFtesting,项目名称:Pulsar,代码行数:101,代码来源:ServiceInstaller.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ PathIsRelative函数代码示例发布时间:2022-05-30
下一篇:
C++ PathFindExtension函数代码示例发布时间: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