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


C++ LPMALLOC类代码示例

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


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

示例1: browseForDir

CString Directories::browseForDir(CString title)
{
  static char buffer[1024];
  LPMALLOC pMalloc;
  LPITEMIDLIST pidl;
  
  CString res;
  
  if(SUCCEEDED(SHGetMalloc(&pMalloc))) {
    BROWSEINFO bi;
    ZeroMemory(&bi, sizeof(bi));
    bi.hwndOwner = m_hWnd;
    bi.lpszTitle = title;
    bi.pidlRoot = 0;
    bi.ulFlags = BIF_RETURNONLYFSDIRS;
    bi.lpfn = browseCallbackProc;
    bi.lParam = (LPARAM)(LPCTSTR)initialFolderDir;
    
    pidl = SHBrowseForFolder(&bi);
    
    if(pidl) {
      if(SHGetPathFromIDList(pidl, buffer)) {
        res = buffer;
      }
      pMalloc->Free(pidl);
      pMalloc->Release();
    }
  }
  return res;
}
开发者ID:BackupTheBerlios,项目名称:vbastep-svn,代码行数:30,代码来源:Directories.cpp

示例2: selectFolder

BOOL selectFolder(HWND hParent, WCHAR *szFolder)
{
	LPMALLOC pMalloc;
	LPITEMIDLIST pidl;
	BROWSEINFO bi;

	bi.hwndOwner = hParent;
	bi.pidlRoot = NULL;
	bi.pszDisplayName = NULL;
	bi.lpszTitle = L"Select Folder to Save";
	bi.ulFlags = 0;
	bi.lpfn = NULL;
	bi.lParam = NULL;

	pidl = SHBrowseForFolder(&bi);

	if (pidl == NULL) {
		return FALSE;
	}
	SHGetPathFromIDList(pidl, szFolder);

	if (SHGetMalloc(&pMalloc) != NOERROR) {
		return FALSE;
	}
	pMalloc->Free(pidl);
	pMalloc->Release();
	return TRUE;
}
开发者ID:weimingtom,项目名称:AokanaCGExtractor,代码行数:28,代码来源:Main.cpp

示例3: _T

wxString CLocalTreeView::GetSpecialFolder(int folder, int &iconIndex, int &openIconIndex)
{
	LPITEMIDLIST list;
	if (SHGetSpecialFolderLocation((HWND)GetHandle(), folder, &list) != S_OK)
		return _T("");

	SHFILEINFO shFinfo;
	if (!SHGetFileInfo((LPCTSTR)list, 0, &shFinfo, sizeof(shFinfo), SHGFI_PIDL | SHGFI_ICON | SHGFI_SMALLICON))
		return _T("");

	DestroyIcon(shFinfo.hIcon);
	iconIndex = shFinfo.iIcon;

	if (!SHGetFileInfo((LPCTSTR)list, 0, &shFinfo, sizeof(shFinfo), SHGFI_PIDL | SHGFI_ICON | SHGFI_SMALLICON | SHGFI_OPENICON | SHGFI_DISPLAYNAME))
		return _T("");

	DestroyIcon(shFinfo.hIcon);
	openIconIndex = shFinfo.iIcon;

	wxString name = shFinfo.szDisplayName;

	LPMALLOC pMalloc;
    SHGetMalloc(&pMalloc);

	if (pMalloc)
	{
		pMalloc->Free(list);
		pMalloc->Release();
	}
	else
		wxLogLastError(wxT("SHGetMalloc"));

	return name;
}
开发者ID:idgaf,项目名称:FileZilla3,代码行数:34,代码来源:LocalTreeView.cpp

示例4: GetDirectoryFromUser

wyBool 
GetDirectoryFromUser(HWND hwnd, wyWChar *dirname, wyWChar *title)
{
	LPMALLOC		lpmalloc;
	BROWSEINFO		brwinf;
	LPITEMIDLIST	lpidl;

	memset(&brwinf, 0, sizeof(brwinf));

	if(SHGetMalloc(&lpmalloc)!= NOERROR)
		return wyFalse;

	brwinf.hwndOwner		= hwnd;
	brwinf.pidlRoot			= NULL;
	brwinf.pszDisplayName	= dirname;
	brwinf.lpszTitle		= title;
	brwinf.ulFlags			= BIF_EDITBOX | BIF_VALIDATE | BIF_NEWDIALOGSTYLE;

    //Displays a dialog box enabling the user to select a Shell folder
	lpidl = SHBrowseForFolder(&brwinf);

	if(!lpidl)
	{
		lpmalloc->Release();
		return wyFalse;
	}

    //Converts an item identifier list to a file system path
	SHGetPathFromIDList(lpidl, dirname);

	lpmalloc->Free(lpidl);
	lpmalloc->Release();

	return wyTrue;
}
开发者ID:AwkwardDev,项目名称:sqlyog-community,代码行数:35,代码来源:FileHelper.cpp

示例5: OnBrowseFolder

void COutputPage::OnBrowseFolder()
{
    TCHAR szPath[MAX_PATH];
    LPITEMIDLIST pPath;
    LPMALLOC pMalloc;
    BROWSEINFO pBI;

    ZeroMemory( &pBI, sizeof(pBI) );
    pBI.hwndOwner		= GetSafeHwnd();
    pBI.pszDisplayName	= szPath;
    pBI.lpszTitle		= _T("Select folder:");
    pBI.ulFlags			= BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE;

    pPath = SHBrowseForFolder( &pBI );
    if ( pPath == NULL ) return;

    SHGetPathFromIDList( pPath, szPath );
    SHGetMalloc( &pMalloc );
    pMalloc->Free( pPath );
    pMalloc->Release();

    UpdateData( TRUE );
    m_sFolder = szPath;
    UpdateData( FALSE );
}
开发者ID:nlstone,项目名称:Shareaza,代码行数:25,代码来源:PageOutput.cpp

示例6: sizeof

BOOL PageSystem2::BrowseForFolder(HWND hOwner, TCHAR* szTitle, TCHAR* szRetval)
{
	BROWSEINFO info;
	LPITEMIDLIST itemidlist;
	TCHAR szDirectory[_MAX_PATH];
	LPMALLOC pMalloc;
	memset(szDirectory, 0, _MAX_PATH * sizeof(TCHAR));

	if (::SHGetMalloc(&pMalloc) == NOERROR)
	{
		info.hwndOwner = hOwner;
		info.pidlRoot = NULL;
		info.pszDisplayName = szDirectory;
		info.lpszTitle = szTitle;
		info.ulFlags = 0;
		info.lpfn = NULL;

		itemidlist = SHBrowseForFolder(&info);
		if (itemidlist != NULL)
		{
			SHGetPathFromIDList(itemidlist, szRetval);
			pMalloc->Free(itemidlist);
			pMalloc->Release();
			return TRUE;
		}
		else // User clicked Cancel
		{
			pMalloc->Release();
			return FALSE;
		}
	}
	else
		return FALSE;
}
开发者ID:ARMCoderCHS,项目名称:ClanLib,代码行数:34,代码来源:page_system2.cpp

示例7: SelectFolder

bool sspGUIfileDialogs::SelectFolder(HWND hOwner, const wchar_t* strTitle, CString& strFolder)
{
	bool bRet = false;

	BROWSEINFO brws = {0};
	wchar_t szName[260];       // buffer for file name
	szName[0] = 0;

	LPMALLOC pMalloc = NULL;
	SHGetMalloc(&pMalloc);

	brws.hwndOwner = hOwner;
	brws.pszDisplayName = szName;
	brws.lpszTitle = strTitle;
	brws.pidlRoot = NULL;
	brws.lpfn = NULL;
	brws.ulFlags = BIF_NONEWFOLDERBUTTON | BIF_RETURNONLYFSDIRS | BIF_DONTGOBELOWDOMAIN;
	LPITEMIDLIST pList = ::SHBrowseForFolder(&brws);
	if (::SHGetPathFromIDList(pList, szName)) {
		strFolder = szName;
		bRet = true;
	}
	if(pList) pMalloc->Free(pList);
	pMalloc->Release();
	return bRet;
}
开发者ID:ssaue,项目名称:soundspace,代码行数:26,代码来源:SSpGUIUtilityEditor.cpp

示例8: GetSpecialDir

extern "C" void
GetSpecialDir(char *dst, size_t size, int whichDir)
{
    LPITEMIDLIST idl;
    LPMALLOC shl;
    char path[MAX_PATH + 1];
    HRESULT hResult;

    memset(dst, 0, size);
    hResult = SHGetMalloc(&shl);
    if (SUCCEEDED(hResult)) {
        hResult = SHGetSpecialFolderLocation(
                      NULL,
                      whichDir,
                      &idl
                  );

        if (SUCCEEDED(hResult)) {
            if(SHGetPathFromIDList(idl, path)) {
                (void) strncpy(dst, path, size - 1);
                dst[size - 1] = '\0';
            }
            shl->Free(idl);
        }
        shl->Release();
    }
}	// GetSpecialDir
开发者ID:cmjonze,项目名称:ncftp,代码行数:27,代码来源:util2.cpp

示例9: BrowseDir

void CBrowseDirectory::BrowseDir(CString& retStr, CWnd* pFromWnd, LPCTSTR Title)
{
   LPMALLOC pMalloc;
   /* Get's the Shell's default allocator */
   if (NOERROR != ::SHGetMalloc(&pMalloc))
      AfxThrowMemoryException();

   BROWSEINFO bi;
   TCHAR pszBuffer[MAX_PATH];
   LPITEMIDLIST pidl;

   InitBrowseInfo(bi, pFromWnd, Title);
   bi.pszDisplayName = pszBuffer;
   // This next call issues the dialog box 
   __try
   {
      if ((pidl = ::SHBrowseForFolder(&bi)) != NULL)
	   {
	      __try
		   {
		      if (::SHGetPathFromIDList(pidl, pszBuffer))
			   { 
			      //At this point pszBuffer contains the selected path */
			      retStr = pszBuffer;
			   }
		   }
	      __finally
		   {
		      // Free the PIDL allocated by SHBrowseForFolder
		      pMalloc->Free(pidl);
		   }
	   }
   }
开发者ID:Mariademo,项目名称:alsigm,代码行数:33,代码来源:BrowseDirectory.cpp

示例10: UpdateData

void CProjectNew::OnProjectSelloc() 
{
	UpdateData(TRUE);

	BROWSEINFO bi;
	TCHAR szDir[MAX_PATH];
	LPITEMIDLIST pidl;
	LPMALLOC pMalloc;

	if (SUCCEEDED(SHGetMalloc(&pMalloc))) 
	{
		ZeroMemory(&bi,sizeof(bi));
		bi.hwndOwner = NULL;
		bi.pszDisplayName = 0;
		bi.pidlRoot = 0;
		bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT;
		bi.lpfn = BrowseCallbackProc;

		pidl = SHBrowseForFolder(&bi);
		if (pidl) 
		{
			if (SHGetPathFromIDList(pidl,szDir)) 
			{
				m_strProjectDir = szDir;
				UpdateData(FALSE);
			}

			// In C++: pMalloc->Free(pidl); pMalloc->Release();
			pMalloc->Free(pidl);
			pMalloc->Release();
		}
	}	
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:33,代码来源:ProjectNew.cpp

示例11: GetMyDocuments

bool Preferences::GetMyDocuments(CString* pPath)
{
    LPITEMIDLIST pidl = NULL;
    LPMALLOC lpMalloc = NULL;
    HRESULT hr;
    bool result = false;

    hr = ::SHGetMalloc(&lpMalloc);
    if (FAILED(hr))
       return NULL;

    hr = SHGetSpecialFolderLocation(NULL, CSIDL_PERSONAL, &pidl);
    if (FAILED(hr)) {
        LOGW("WARNING: unable to get CSIDL_PERSONAL");
        goto bail;
    }

    result = (Pidl::GetPath(pidl, pPath) != FALSE);
    if (!result) {
        LOGW("WARNING: unable to convert CSIDL_PERSONAL to path");
        /* fall through with "result" */
    }

bail:
    lpMalloc->Free(pidl);
    lpMalloc->Release();
    return result;
}
开发者ID:HankG,项目名称:ciderpress,代码行数:28,代码来源:Preferences.cpp

示例12: UpdateData

void CFileFindDlg::OnFolderbrowseBtn() 
{
	UpdateData(TRUE);
	BROWSEINFO bi;
	TCHAR szDir[MAX_PATH];
	
	LPMALLOC pMalloc;

	if (SUCCEEDED(SHGetMalloc(&pMalloc))) 
	{
		ZeroMemory(&bi,sizeof(bi));
		bi.hwndOwner = m_hWnd;
		bi.pszDisplayName = 0;
		bi.pidlRoot = 0;
		bi.ulFlags = BIF_RETURNONLYFSDIRS |/* BIF_STATUSTEXT | */BIF_EDITBOX | BIF_NEWDIALOGSTYLE;
		bi.lpfn = CFileFindDlg::BrowseCallbackProc;
		bi.lParam = (LPARAM)this;

		ITEMIDLIST* pidl = SHBrowseForFolder(&bi);
		if (pidl) 
		{
			if (SHGetPathFromIDList(pidl,szDir)) 
			{
				m_FindFolder = szDir;
				UpdateData(FALSE);
			}

			pMalloc->Free(pidl); 
			pMalloc->Release();
		}
	}
}
开发者ID:lassoan,项目名称:PythonVisualDebugger,代码行数:32,代码来源:FileFindDlg.cpp

示例13: Show

//
//	フォルダー選択ダイアログの表示
//
//		結果は"c:\windows\"のように末尾に必ず"\"が付加する
//
bool CFolderSelect::Show(CString* lpstrFolder,CString strIniFolder,bool bAvailNewFolder)
{
	bool			ret;
	char			lpszPath[MAX_PATH];
	LPMALLOC		lpMalloc;
	BROWSEINFO		sInfo;
	LPITEMIDLIST	lpidlRoot;
	LPITEMIDLIST	lpidlBrowse;

	if(lpstrFolder == NULL)
		return	false;

	if(::SHGetMalloc(&lpMalloc) != NOERROR)
		return	false;

	ret = false;
	*lpstrFolder = "";
	if(strIniFolder != "")
	{
		if(strIniFolder.Right(1) == "\\")
			strIniFolder = strIniFolder.Left(strIniFolder.GetLength() - 1);			//末尾の\\を除去
	}

	::SHGetSpecialFolderLocation(NULL, CSIDL_DRIVES, &lpidlRoot);	//選択可能フォルダ名取得

	::ZeroMemory(&sInfo, sizeof(BROWSEINFO));
	sInfo.pidlRoot		= lpidlRoot;
	sInfo.pszDisplayName = lpszPath;
	sInfo.lpszTitle		= _T("フォルダの選択");
	sInfo.ulFlags		= BIF_RETURNONLYFSDIRS;
	if(bAvailNewFolder == true)
		sInfo.ulFlags	|= BIF_EDITBOX | BIF_NEWDIALOGSTYLE | BIF_USENEWUI;
	sInfo.lpfn			= _SHBrowseForFolderCallbackProc;
	sInfo.lParam		= (LPARAM)strIniFolder.GetBuffer(0);

	lpidlBrowse = ::SHBrowseForFolder(&sInfo);			//フォルダ選択ダイアログ表示
	if(lpidlBrowse != NULL)
	{
		::SHGetPathFromIDList(lpidlBrowse,lpszPath);	//フォルダ名の取得
		*lpstrFolder = lpszPath;

		if(*lpstrFolder != "")
		{
			if(lpstrFolder->Right(1) != "\\")
				*lpstrFolder += "\\";			//末尾に\\が付加することを保証
		}

		ret = true;
	}

	if(lpidlBrowse != NULL)
		::CoTaskMemFree(lpidlBrowse);
	if(lpidlRoot != NULL)
		::CoTaskMemFree(lpidlRoot);

	lpMalloc->Release();

	return	ret;
}
开发者ID:mak-oh-1977,项目名称:CamFileCopy,代码行数:64,代码来源:FolderSelect.cpp

示例14: folderBrowser

generic_string folderBrowser(HWND parent, const generic_string & title, int outputCtrlID, const TCHAR *defaultStr)
{
	generic_string dirStr;

	// This code was copied and slightly modifed from:
	// http://www.bcbdev.com/faqs/faq62.htm

	// SHBrowseForFolder returns a PIDL. The memory for the PIDL is
	// allocated by the shell. Eventually, we will need to free this
	// memory, so we need to get a pointer to the shell malloc COM
	// object that will free the PIDL later on.
	LPMALLOC pShellMalloc = 0;
	if (::SHGetMalloc(&pShellMalloc) == NO_ERROR)
	{
		// If we were able to get the shell malloc object,
		// then proceed by initializing the BROWSEINFO stuct
		BROWSEINFO info;
		memset(&info, 0, sizeof(info));
		info.hwndOwner = parent;
		info.pidlRoot = NULL;
		TCHAR szDisplayName[MAX_PATH];
		info.pszDisplayName = szDisplayName;
		info.lpszTitle = title.c_str();
		info.ulFlags = 0;
		info.lpfn = BrowseCallbackProc;

		TCHAR directory[MAX_PATH];
		if (outputCtrlID != 0)
			::GetDlgItemText(parent, outputCtrlID, directory, _countof(directory));
		directory[_countof(directory) - 1] = '\0';

		if (!directory[0] && defaultStr)
			info.lParam = reinterpret_cast<LPARAM>(defaultStr);
		else
			info.lParam = reinterpret_cast<LPARAM>(directory);

		// Execute the browsing dialog.
		LPITEMIDLIST pidl = ::SHBrowseForFolder(&info);

		// pidl will be null if they cancel the browse dialog.
		// pidl will be not null when they select a folder.
		if (pidl)
		{
			// Try to convert the pidl to a display generic_string.
			// Return is true if success.
			TCHAR szDir[MAX_PATH];
			if (::SHGetPathFromIDList(pidl, szDir))
			{
				// Set edit control to the directory path.
				if (outputCtrlID != 0)
					::SetDlgItemText(parent, outputCtrlID, szDir);
				dirStr = szDir;
			}
			pShellMalloc->Free(pidl);
		}
		pShellMalloc->Release();
	}
	return dirStr;
}
开发者ID:125radheyshyam,项目名称:notepad-plus-plus,代码行数:59,代码来源:Common.cpp

示例15: getDevFilter

// Used (by getDeviceModes) to select a device
// so we can list its properties
static IBaseFilter* getDevFilter(QString devName)
{
    IBaseFilter* devFilter = nullptr;
    devName = devName.mid(6); // Remove the "video="
    IMoniker* m = nullptr;

    ICreateDevEnum* devenum = nullptr;
    if (CoCreateInstance(CLSID_SystemDeviceEnum, nullptr, CLSCTX_INPROC_SERVER,
                             IID_ICreateDevEnum, (void**) &devenum) != S_OK)
        return devFilter;

    IEnumMoniker* classenum = nullptr;
    if (devenum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory,
                                (IEnumMoniker**)&classenum, 0) != S_OK)
        return devFilter;

    while (classenum->Next(1, &m, nullptr) == S_OK)
    {
        LPMALLOC coMalloc = nullptr;
        IBindCtx* bindCtx = nullptr;
        LPOLESTR olestr = nullptr;
        char* devIdString;

        if (CoGetMalloc(1, &coMalloc) != S_OK)
            goto fail;
        if (CreateBindCtx(0, &bindCtx) != S_OK)
            goto fail;

        if (m->GetDisplayName(bindCtx, nullptr, &olestr) != S_OK)
            goto fail;
        devIdString = wcharToUtf8(olestr);

        // replace ':' with '_' since FFmpeg uses : to delimitate sources
        for (unsigned i = 0; i < strlen(devIdString); i++)
            if (devIdString[i] == ':')
                devIdString[i] = '_';

        if (devName != devIdString)
            goto fail;

        if (m->BindToObject(0, 0, IID_IBaseFilter, (void**)&devFilter) != S_OK)
            goto fail;

fail:
        if (olestr && coMalloc)
            coMalloc->Free(olestr);
        if (bindCtx)
            bindCtx->Release();
        delete[] devIdString;
        m->Release();
    }
    classenum->Release();

    if (!devFilter)
        qWarning() << "Could't find the device "<<devName;

    return devFilter;
}
开发者ID:13983441921,项目名称:qTox,代码行数:60,代码来源:directshow.cpp


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