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


C++ LPSTREAM类代码示例

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


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

示例1: bkimg

static Gdiplus::Image* bkimg(int rcid) {
   HRSRC hrsc = ::FindResource(hInst, MAKEINTRESOURCE(rcid), TEXT("PNG"));
   DWORD size = ::SizeofResource(hInst, hrsc);
   LPVOID hg = ::LoadResource(hInst, hrsc);
   HGLOBAL mem = ::GlobalAlloc(GMEM_MOVEABLE, size);
   Gdiplus::Image* img = 0;
   if (mem) {
      LPVOID pmem = ::GlobalLock(mem);
      if (pmem) {
         ::CopyMemory(pmem, hg, size);
         LPSTREAM is;
         if (::CreateStreamOnHGlobal(pmem, FALSE, &is) == S_OK) {
            Gdiplus::Image* m = new Gdiplus::Image(is);
            is->Release();
            if (m->GetLastStatus() != Gdiplus::Ok) {
               delete m;
               return img;
            }
            img = m;
         }
         ::GlobalUnlock(mem);
      }
      ::GlobalFree(mem);
   }
   return img;
}
开发者ID:wangch,项目名称:zipk,代码行数:26,代码来源:zipk.cpp

示例2: AfxGetResourceHandle

void CScratchPadDlg::LoadSrcImage()
{
	HINSTANCE hResInstance = AfxGetResourceHandle( );

	HRSRC res = FindResource(hResInstance,
		MAKEINTRESOURCE(IDB_BITMAP1),L"BINARY");
	if (res) 
	{
		HGLOBAL mem = LoadResource(hResInstance, res);
		void *data = LockResource(mem);
		size_t len = SizeofResource(hResInstance, res);

		HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE, len);
		LPVOID pvData = GlobalLock( hGlobal );
		memcpy(pvData,data,len);
		GlobalUnlock(hGlobal);

		LPSTREAM pStream = NULL;
		HRESULT hr = CreateStreamOnHGlobal( hGlobal, TRUE, &pStream );

		using namespace Gdiplus;
		m_pSrcBitmap = new Bitmap(pStream,false);

		pStream->Release();
	}
}
开发者ID:shaovoon,项目名称:outline-text,代码行数:26,代码来源:ScratchPadDlg.cpp

示例3: FileUpload

BOOL FileUpload(Zimbra::Rpc::ZimbraConnection *z_connection, LPWSTR *ppwszToken)
{
    LOGFN_INTERNAL_NO;

    LPSTR pszTestFile = "E:\\temp\\aa.log";
    LPSTREAM pStreamFile = NULL;
    HRESULT hr = OpenStreamOnFile(MAPIAllocateBuffer, MAPIFreeBuffer, STGM_READ,
        (LPWSTR)pszTestFile, NULL, &pStreamFile);

    if (FAILED(hr))
    {
        LOG_ERROR(_T("failed to OpenStreamOnFile call: %x"), hr);
        return FALSE;
    }

    HANDLE hFile = CreateFile(L"E:\\temp\\aa.log", GENERIC_READ, FILE_SHARE_READ, NULL,
        OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
    DWORD dwFileSize = GetFileSize(hFile, NULL);

    CloseHandle(hFile);
    _tprintf(_T("  File Upload size=%d bytes\n"), dwFileSize);

    BOOL bResult = z_connection->DoFileUpload(pStreamFile, dwFileSize,
        L"/service/upload?fmt=raw", ppwszToken, NULL);

    pStreamFile->Release();

    return bResult;
}
开发者ID:fciubotaru,项目名称:z-pec,代码行数:29,代码来源:PSTMigration.cpp

示例4: Load

HRESULT STDMETHODCALLTYPE CXMLDocument::Load(/* [in] */ LPSTREAM pStm)
{
	if (pStm == NULL)
	{
		return E_INVALIDARG;
	}

	// Load the XML from the stream
	STATSTG statstg;
	pStm->Stat(&statstg, STATFLAG_NONAME);

	ULONG cbBufSize = statstg.cbSize.LowPart;

	char *pBuffer = new char[cbBufSize];
	if (pBuffer == NULL)
	{
		return E_OUTOFMEMORY;
	}

	memset(pBuffer, 0, cbBufSize);
	pStm->Read(pBuffer, cbBufSize, NULL);

	m_spRoot.Release();
	ParseExpat(pBuffer, cbBufSize, (IXMLDocument *) this, &m_spRoot);

	delete []pBuffer;

	m_nReadyState = READYSTATE_LOADED;

	return S_OK;
}
开发者ID:EdgarChen,项目名称:mozilla-cvs-history,代码行数:31,代码来源:XMLDocument.cpp

示例5: _AfxLoadStreamFromPropset

LPSTREAM AFXAPI _AfxLoadStreamFromPropset(CPropertySection& psec, LPCTSTR pszPropName,
	DWORD& vtType)
{
	ASSERT(AfxIsValidString(pszPropName));

	vtType = VT_EMPTY;

	DWORD dwPropID;
	CProperty* pprop = NULL;
	LPSTREAM pstm = NULL;

	if (psec.GetID(pszPropName, &dwPropID) &&
		((pprop = psec.GetProperty(dwPropID)) != NULL))
	{
		vtType = pprop->GetType();

		if ((vtType == VT_BLOB) || (vtType == VT_BLOB_PROPSET))
		{
			pstm = _AfxCreateMemoryStream();

			if (pstm != NULL)
			{
				if (!_AfxInitStreamDataFromBlobProp(pstm, pprop))
				{
					pstm->Release();
					pstm = NULL;
				}
			}
		}
	}

	return pstm;
}
开发者ID:anyue100,项目名称:winscp,代码行数:33,代码来源:ctlpset.cpp

示例6: Save

STDMETHODIMP VLCPersistStorage::Save(LPSTORAGE pStg, BOOL fSameAsLoad)
{
    if( NULL == pStg )
        return E_INVALIDARG;

    if( fSameAsLoad && (S_FALSE == IsDirty()) )
        return S_OK;

    LPSTREAM pStm = NULL;
    HRESULT result = pStg->CreateStream(L"VideoLAN ActiveX Plugin Data",
                        STGM_CREATE|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, 0, 0, &pStm);

    if( FAILED(result) )
        return result;

    LPPERSISTSTREAMINIT pPersistStreamInit;
    if( SUCCEEDED(QueryInterface(IID_IPersistStreamInit, (void **)&pPersistStreamInit)) )
    {
        result = pPersistStreamInit->Save(pStm, fSameAsLoad);
        pPersistStreamInit->Release();
    }

    pStm->Release();

    return result;
};
开发者ID:forthyen,项目名称:npapi-vlc,代码行数:26,代码来源:persiststorage.cpp

示例7:

FARINTERNAL UtDIBFileStmToPBrushNativeStm
	(LPSTREAM pstmDIBFile, LPSTREAM pstmPBrush)
{
	BITMAPFILEHEADER bfh;
	HRESULT	error;
	
	if (error = pstmDIBFile->Read(&bfh, sizeof(bfh), 0))
		return error;
	
	// seek to the begining of the stream
	LARGE_INTEGER large_int;
	LISet32( large_int, 0);
	if (error = pstmDIBFile->Seek(large_int, STREAM_SEEK_SET, 0))
		return error;
	
	if (error = pstmPBrush->Write(&(bfh.bfSize), sizeof(DWORD), 0))
		return error;
	
	ULARGE_INTEGER ularge_int;
	ULISet32(ularge_int, bfh.bfSize);
	
	if ((error = pstmDIBFile->CopyTo(pstmPBrush, ularge_int,
			NULL, NULL)) == NOERROR)
		StSetSize(pstmPBrush, 0, TRUE);
	
	return error;
}
开发者ID:mingpen,项目名称:OpenNT,代码行数:27,代码来源:ddecnvrt.cpp

示例8: ReadFromStorage

BOOL CSummInfo::ReadFromStorage(LPSTORAGE lpRootStg)
{
	if (lpRootStg != NULL)
	{
		LPSTREAM lpStream = NULL;

		if (FAILED(lpRootStg->OpenStream(szSummInfo,
				   NULL, STGM_SHARE_EXCLUSIVE|STGM_READ,
				   0, &lpStream)))
		{
			TRACE(_T("OpenStream failed\n"));
			return FALSE;
		}
		else
		{
			if (!m_propSet.ReadFromStream(lpStream))
			{
				TRACE(_T("ReadFromStream failed\n"));
				return FALSE;
			}
			m_pSection = m_propSet.GetSection(FMTID_SummaryInformation);
			lpStream->Release();
			return TRUE;
		}
	}
	return FALSE;
}
开发者ID:zxlooong,项目名称:bcgexp,代码行数:27,代码来源:summinfo.cpp

示例9: dwSize

FARINTERNAL UtPlaceableMFStmToMSDrawNativeStm
	(LPSTREAM pstmPMF, LPSTREAM pstmMSDraw)
{
	DWORD	dwSize;	// size of metafile bits excluding the placeable MF header
	LONG	xExt;
	LONG	yExt;
	WORD	wBuf[5]; // dwSize(DWORD), mm(int), xExt(int), yExt(int)
	HRESULT error;
	
	if (error = UtGetSizeAndExtentsFromPlaceableMFStm(pstmPMF, &dwSize,
			&xExt, &yExt))
		return error;		

	*((DWORD FAR*) wBuf) = dwSize + 3*sizeof(WORD);
	wBuf[2] = MM_ANISOTROPIC;
	wBuf[3] = (int) xExt;
	wBuf[4] = (int) yExt;
	
	if (error = pstmMSDraw->Write(wBuf, sizeof(wBuf), 0))
		return error;

	ULARGE_INTEGER ularge_int;
	ULISet32(ularge_int, dwSize);
	if ((error = pstmPMF->CopyTo(pstmMSDraw, ularge_int,
			NULL, NULL)) == NOERROR)
		StSetSize(pstmMSDraw, 0, TRUE);
	
	return error;
				
}
开发者ID:mingpen,项目名称:OpenNT,代码行数:30,代码来源:ddecnvrt.cpp

示例10: WriteToStorage

BOOL CSummInfo::WriteToStorage(LPSTORAGE lpRootStg)
{
	if (lpRootStg != NULL)
	{
		LPSTREAM lpStream = NULL;
		if (FAILED(lpRootStg->CreateStream(szSummInfo,
				   STGM_SHARE_EXCLUSIVE|STGM_CREATE|STGM_READWRITE,
				   0, 0, &lpStream)))
		{
			TRACE(_T("CreateStream failed\n"));
			return FALSE;
		}
		else
		{
			if(!m_propSet.WriteToStream(lpStream))
			{
				TRACE(_T("WriteToStream failed\n"));
				return FALSE;
			}
			lpRootStg->Commit(STGC_DEFAULT);
			lpStream->Release();
			return TRUE;
		}
	}
	return FALSE;
}
开发者ID:zxlooong,项目名称:bcgexp,代码行数:26,代码来源:summinfo.cpp

示例11: SaveAs

	HRESULT STDMETHODCALLTYPE TinySmiley::SaveAs(LPSTREAM pStm)//默认保存第一帧到文件流
	{
		if (!pStm) return S_FALSE;
		if (m_images.size() == 0) return S_FALSE;

		BITMAP bitmap = { 0 };
		if (!GetObject(m_images[0], sizeof(BITMAP), (LPSTR)&bitmap))
			return S_FALSE;
		BITMAPINFOHEADER bi = { 0 };
		bi.biSize = sizeof(BITMAPINFOHEADER);
		bi.biWidth = bitmap.bmWidth;
		bi.biHeight = bitmap.bmHeight;
		bi.biPlanes = 1;
		bi.biBitCount = bitmap.bmBitsPixel;
		bi.biCompression = BI_RGB;
		DWORD size = bitmap.bmWidthBytes * bitmap.bmHeight;
		BITMAPFILEHEADER bfh = { 0 };
		bfh.bfType = 0x4d42;
		bfh.bfOffBits = min(14, sizeof(BITMAPFILEHEADER)) + sizeof(BITMAPINFOHEADER) + bi.biClrUsed * sizeof(RGBQUAD);
		bfh.bfSize = bfh.bfOffBits + bitmap.bmWidthBytes*bitmap.bmHeight;
		ULARGE_INTEGER libSize;
		libSize.LowPart = bfh.bfSize;
		pStm->SetSize(libSize);
		ULONG cbWritten = 0;
		pStm->Write(&bfh, min(14, sizeof(BITMAPFILEHEADER)), &cbWritten);
		pStm->Write(&bi, bi.biSize, &cbWritten);
		pStm->Write(bitmap.bmBits, bitmap.bmWidthBytes*bitmap.bmHeight, &cbWritten);
		return S_OK;
	}
开发者ID:91yuan,项目名称:TinyUI,代码行数:29,代码来源:TinySmiley.cpp

示例12: SetPropertyString

bool MAPIContact::SetNotes(const String &szNotes, bool bRTF) {
#ifdef _WIN32_WCE
	return SetPropertyString(PR_BODY, szNotes);
#else
	if(!Contact() || IsNull(szNotes)) 
		return false;
	ULONG nLen = (ULONG)szNotes.GetLength();

	HRESULT hr = E_FAIL;
	LPSTREAM pStream = NULL;
	if(bRTF) {
		if(Contact()->OpenProperty(PR_RTF_COMPRESSED, &IID_IStream, STGM_CREATE | STGM_WRITE, 
								MAPI_MODIFY | MAPI_CREATE, (LPUNKNOWN*)&pStream) == S_OK) {
			IStream *pUncompressed;
			if(WrapCompressedRTFStream(pStream,MAPI_MODIFY, &pUncompressed) == S_OK) {
				hr = pUncompressed->Write(szNotes, nLen*sizeof(TCHAR), NULL);
				if(pUncompressed->Commit(STGC_DEFAULT)==S_OK) 
					pStream->Commit(STGC_DEFAULT);
				RELEASE(pUncompressed);
			}
		}
	} else {
		if(Contact()->OpenProperty(PR_BODY, &IID_IStream, 0, MAPI_MODIFY | MAPI_CREATE, 
																(LPUNKNOWN*)&pStream) == S_OK) 
			hr = pStream->Write(szNotes, (nLen+1)*sizeof(TCHAR), NULL);
	}
	RELEASE(pStream);
	return (hr == S_OK);
#endif
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:30,代码来源:MAPIContact.cpp

示例13: memcpy

BOOL CGifImage::LoadFromBuffer(const BYTE* lpBuf, DWORD dwSize)
{
	if (NULL == lpBuf || dwSize <= 0)
		return FALSE;

	HGLOBAL hGlobal = ::GlobalAlloc(GHND, dwSize);
	if (NULL == hGlobal)
		return FALSE;

	LPVOID lpBuffer = ::GlobalLock(hGlobal);
	if (NULL == lpBuffer)
	{
		::GlobalFree(hGlobal);
		return FALSE;
	}

	memcpy(lpBuffer, lpBuf, dwSize);
	::GlobalUnlock(hGlobal);

	LPSTREAM lpStream = NULL;
	HRESULT hr = ::CreateStreamOnHGlobal(hGlobal, TRUE, &lpStream);
	if (hr != S_OK)
	{
		::GlobalFree(hGlobal);
		return FALSE;
	}

	BOOL bRet = LoadFromIStream(lpStream);
	lpStream->Release();

	return bRet;
}
开发者ID:03050903,项目名称:MingQQ,代码行数:32,代码来源:GifImage.cpp

示例14: memcpy

BOOL CImageEx::LoadFromResource(HINSTANCE hInstance, LPCTSTR pszResourceName, LPCTSTR pszResType)
{
	HRSRC hRsrc = ::FindResource(hInstance, pszResourceName, pszResType);
	if (NULL == hRsrc)
		return FALSE;

	DWORD dwSize = ::SizeofResource(hInstance, hRsrc); 
	if (0 == dwSize)
		return FALSE;

	HGLOBAL hGlobal = ::LoadResource(hInstance, hRsrc); 
	if (NULL == hGlobal)
		return FALSE;

	LPVOID pBuffer = ::LockResource(hGlobal);
	if (NULL == pBuffer)
	{
		::FreeResource(hGlobal);
		return FALSE;
	}

	HGLOBAL hGlobal2 = ::GlobalAlloc(GHND, dwSize);
	if (NULL == hGlobal2)
	{
		::FreeResource(hGlobal);
		return FALSE;
	}

	LPVOID pBuffer2 = ::GlobalLock(hGlobal2);
	if (NULL == pBuffer2)
	{
		::GlobalFree(hGlobal2);
		::FreeResource(hGlobal);
		return FALSE;
	}

	memcpy(pBuffer2, pBuffer, dwSize);
	::GlobalUnlock(hGlobal2);

	LPSTREAM pStream = NULL;
	HRESULT hr = ::CreateStreamOnHGlobal(hGlobal2, TRUE, &pStream);
	if (hr != S_OK)
	{
		::GlobalFree(hGlobal2);
		::FreeResource(hGlobal);
		return FALSE;
	}

	BOOL bRet = LoadFromIStream(pStream);

	if (pStream)
		pStream->Release();

	::FreeResource(hGlobal);

	return bRet;
}
开发者ID:janseM3319,项目名称:mingqq,代码行数:57,代码来源:ImageEx.cpp

示例15: START_FUNCTION_BOOL

/*static */
bool display_t::save_bitmap(const char *szFileName, HBITMAP bmp, HPALETTE pal /*= NULL*/)
{
	START_FUNCTION_BOOL();

	PICTDESC pdPictDesc;
	pdPictDesc.cbSizeofstruct = sizeof(PICTDESC);
	pdPictDesc.picType = PICTYPE_BITMAP;
	pdPictDesc.bmp.hbitmap = bmp;
	pdPictDesc.bmp.hpal = pal;

	LPPICTURE plPicture = NULL;
	HRESULT hResult = OleCreatePictureIndirect(&pdPictDesc, IID_IPicture, false, reinterpret_cast<void**>(&plPicture));

	if (!SUCCEEDED(hResult))
	{
		break;
	}

	LPSTREAM lpStream = NULL;
	hResult = CreateStreamOnHGlobal(0, true, &lpStream);

	if (!SUCCEEDED(hResult))
	{
		plPicture->Release();
		return false;
	}

	LONG lBytesStreamed = 0;
	hResult = plPicture->SaveAsFile(lpStream, true, &lBytesStreamed);

	HANDLE hFile = CreateFileA(szFileName, GENERIC_WRITE, FILE_SHARE_READ, 0,
		CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);

	if (!SUCCEEDED(hResult) || !hFile)
	{
		lpStream->Release();
		plPicture->Release();
		break;
	}

	HGLOBAL hgMemory = 0;
	GetHGlobalFromStream(lpStream, &hgMemory);
	LPVOID lpData = GlobalLock(hgMemory);

	DWORD dwBytesWritten = 0;

	bool bResult = !!WriteFile(hFile, lpData, lBytesStreamed, &dwBytesWritten, 0);
	bResult &= (dwBytesWritten == static_cast<DWORD>(lBytesStreamed));

	GlobalUnlock(hgMemory);
	CloseHandle(hFile);

	lpStream->Release();
	plPicture->Release();

	END_FUNCTION_BOOL();
}
开发者ID:starand,项目名称:cpp,代码行数:58,代码来源:display.cpp


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