本文整理汇总了C++中LPSTREAM::Read方法的典型用法代码示例。如果您正苦于以下问题:C++ LPSTREAM::Read方法的具体用法?C++ LPSTREAM::Read怎么用?C++ LPSTREAM::Read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPSTREAM
的用法示例。
在下文中一共展示了LPSTREAM::Read方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Load
STDMETHODIMP CValueAxis::Load(LPSTREAM pStm)
{
pStm->Read(&m_iWholeDigits, sizeof(int), NULL);
pStm->Read(&m_iDecimalDigits, sizeof(int), NULL);
pStm->Read(&m_dMinVal, sizeof(double), NULL);
pStm->Read(&m_dMaxVal, sizeof(double), NULL);
return CAxis::Load(pStm);
}
示例2:
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;
}
示例3: 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;
}
示例4: Load
STDMETHODIMP CGrid::Load(LPSTREAM pStm)
{
pStm->Read(&m_bShowVertical, sizeof(m_bShowVertical), NULL);
pStm->Read(&m_bShowHorizontal, sizeof(m_bShowHorizontal), NULL);
pStm->Read(&m_lNumberOfVerticalLines, sizeof(m_lNumberOfVerticalLines), NULL);
pStm->Read(&m_lNumberOfHorizontalLines, sizeof(m_lNumberOfHorizontalLines), NULL);
pStm->Read(&m_enumVerticalStyle, sizeof(m_enumVerticalStyle), NULL);
pStm->Read(&m_enumHorizontalStyle, sizeof(m_enumHorizontalStyle), NULL);
pStm->Read(&m_nWidth, sizeof(m_nWidth), NULL);
pStm->Read(&m_clrVerticalColor, sizeof(m_clrVerticalColor), NULL);
pStm->Read(&m_clrHorizontalColor, sizeof(m_clrHorizontalColor), NULL);
return S_OK;
}
示例5: _AfxCreateFontFromStream
LPFONT AFXAPI _AfxCreateFontFromStream(LPSTREAM pstm)
{
BOOL bSuccess = FALSE;
LPFONT pFont = NULL;
LPPERSISTSTREAM pPersStm = NULL;
CLSID clsid;
if (SUCCEEDED(pstm->Read(&clsid, sizeof(CLSID), NULL)))
{
HRESULT hr;
if (IsEqualCLSID(clsid, CLSID_StdFont) ||
IsEqualCLSID(clsid, _afx_CLSID_StdFont_V1))
{
// We know this kind of font; create it using the API.
hr = ::OleCreateFontIndirect((LPFONTDESC)&_afxFontDescHelv, IID_IFont,
(LPVOID*)&pFont);
}
else
{
// Some other implementation of IFont.
hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, IID_IFont,
(LPVOID*)&pFont);
}
if (SUCCEEDED(hr))
{
// Successfully created font, now get its IPersistStream interface.
ASSERT_POINTER(pFont, IFont);
if (SUCCEEDED(pFont->QueryInterface(IID_IPersistStream,
(LPVOID*)&pPersStm)))
{
ASSERT_POINTER(pPersStm, IPersistStream);
}
}
if (pPersStm != NULL)
{
// Load the font.
ASSERT_POINTER(pFont, IFont);
bSuccess = SUCCEEDED(pPersStm->Load(pstm));
pPersStm->Release();
}
}
// If we failed for any reason, clean up the font.
if (!bSuccess && pFont != NULL)
{
pFont->Release();
pFont = NULL;
}
return pFont;
}
示例6: IPersistStreamInit_Load
HRESULT CGifSmileyCtrl::IPersistStreamInit_Load(LPSTREAM pStm,const ATL_PROPMAP_ENTRY* pMap)
{
HRESULT hr = S_OK;
INFO_GIF infoGif;
hr = pStm->Read(&infoGif, sizeof(INFO_GIF), NULL);
hr = IPersistStreamInitImpl<CGifSmileyCtrl>::IPersistStreamInit_Load( pStm, pMap);
CopySmile(infoGif.hwndFrom, infoGif.filePath, infoGif.clrBackground, 0);
return hr;
}
示例7: DoLoad
HRESULT CDrawMenu::DoLoad(DWORD dwVer, LPSTREAM pStm)
{
if (dwVer > _SUPERCX_VER_0200)
{
pStm->Read(&m_bButtonDisplayed, sizeof(m_bButtonDisplayed), NULL);
m_bstrButtonCaption.ReadFromStream(pStm);
}
else
{
m_bButtonDisplayed = FALSE;
}
int nCount;
pStm->Read(&nCount, sizeof(nCount), NULL);
for (int i = 0; i < nCount; i++)
{
CMenuItem item;
item.m_bstrText.ReadFromStream(pStm);
pStm->Read(&item.m_dwState, sizeof(DWORD), NULL);
if (dwVer > _SUPERCX_VER_0203)
{
item.m_bstrID.ReadFromStream(pStm);
pStm->Read(&item.m_dwShiftState, sizeof(DWORD), NULL);
pStm->Read(&item.m_dwKeyCode, sizeof(DWORD), NULL);
}
m_arrItems.Add(item);
}
pStm->Read(&m_rcPosition, sizeof(m_rcPosition), NULL);
m_bstrDescription.ReadFromStream(pStm);
return CCxDrawObjectBase::DoLoad(dwVer, pStm);
}
示例8: LoadOldVer
STDMETHODIMP CDrawTxt::LoadOldVer(LPSTREAM pStm)
{
// pStm->Read(&m_bAutoSize, sizeof(BOOL), NULL);
pStm->Read(&m_dFontHeight, sizeof(double), NULL);
pStm->Read(&m_dFontWidth, sizeof(double), NULL);
pStm->Read(&m_lWeight, sizeof(long), NULL);
pStm->Read(&m_bItalic, sizeof(BOOL), NULL);
pStm->Read(&m_bUnderLine, sizeof(BOOL), NULL);
pStm->Read(&m_bStrikethrough, sizeof(BOOL), NULL);
m_bstrFontName.ReadFromStream(pStm);
m_bstrCaption.ReadFromStream(pStm);
pStm->Read(&m_clrForeColor, sizeof(OLE_COLOR), NULL);
pStm->Read(&m_clrBackColor, sizeof(OLE_COLOR), NULL);
pStm->Read(&m_nTextAlign, sizeof(UINT), NULL);
pStm->Read(&m_bsBackStyle, sizeof(enumBackStyle), NULL);
pStm->Read(&m_rcPosition, sizeof(RECTF), NULL);
return ICxDrawObjectImpl<CDrawTxt>::LoadOldVer(pStm);
}
示例9: ReadStorage
void ReadStorage(LPSTORAGE pStg)
// reads one storage -- recursive calls for substorages
{
USES_CONVERSION;
LPSTORAGE pSubStg = NULL;
LPSTREAM pStream = NULL;
LPENUMSTATSTG pEnum = NULL;
LPMALLOC pMalloc = NULL; // for freeing statstg
STATSTG statstg;
ULONG nLength;
BYTE buffer[101];
g_nIndent++;
::CoGetMalloc(MEMCTX_TASK, &pMalloc); // assumes AfxOleInit
// was called
VERIFY(pStg->EnumElements(0, NULL, 0, &pEnum) == S_OK);
while (pEnum->Next(1, &statstg, NULL) == S_OK) {
if (statstg.type == STGTY_STORAGE) {
VERIFY(pStg->OpenStorage(statstg.pwcsName, NULL,
STGM_READ | STGM_SHARE_EXCLUSIVE,
NULL, 0, &pSubStg) == S_OK);
ASSERT(pSubStg != NULL);
TRACE("%0.*sStorage = %s\n", (g_nIndent - 1) * 4,
g_szBlanks, OLE2CT(statstg.pwcsName));
ReadStorage(pSubStg);
pSubStg->Release();
}
else if (statstg.type == STGTY_STREAM) {
VERIFY(pStg->OpenStream(statstg.pwcsName, NULL,
STGM_READ | STGM_SHARE_EXCLUSIVE,
0, &pStream) == S_OK);
ASSERT(pStream != NULL);
TRACE("%0.*sStream = %s\n", (g_nIndent - 1) * 4,
g_szBlanks, OLE2CT(statstg.pwcsName));
pStream->Read(buffer, 100, &nLength);
buffer[nLength] = '\0';
TRACE("%s\n", buffer);
pStream->Release();
}
else {
ASSERT(FALSE); // LockBytes?
}
pMalloc->Free(statstg.pwcsName); // avoids memory leaks
}
pMalloc->Release();
pEnum->Release();
g_nIndent--;
}
示例10: Load
// --------------------------------------------------------------------------------------------
STDMETHODIMP CRegOperatPropAct::Load (LPSTREAM pStm)
{
if (m_bIsInitialized) // m_bIsInitialized == true, wenn Page schon durch InitNew()
return E_UNEXPECTED; // initialisiert wurde
// Daten einlesen
// zuerst Bezeichner einlesen
HRESULT hr = CPropertyAction::Load (pStm);
if (FAILED(hr)) return hr;
// meine Versionsnummer und Signatur lesen und überprüfen
DWORD dwSignature = 0;
DWORD dwVersion = 0;
RETURN_FAILED_HRESULT(pStm->Read (&dwSignature, sizeof(DWORD), NULL));
if (REGOPERATPROPACT_SIGNATURE != dwSignature)
return E_UNEXPECTED;
RETURN_FAILED_HRESULT(pStm->Read (&dwVersion, sizeof(DWORD), NULL));
if ((dwVersion & ~ MINOR_VERSION_MASK) > REGOPERATPROPACT_ACTVERSION)
return STG_E_OLDDLL; // File was written with a newer version
// dann selektierte Info der letzten Auswahl
RETURN_FAILED_HRESULT (pStm->Read (&m_caSelInfo.bClassKey, sizeof(BOOL), NULL));
RETURN_FAILED_HRESULT (pStm->Read (&m_caSelInfo.bInter, sizeof(BOOL), NULL));
RETURN_FAILED_HRESULT (pStm->Read (&m_caSelInfo.bExter, sizeof(BOOL), NULL));
RETURN_FAILED_HRESULT (pStm->Read (&m_caSelInfo.bBound, sizeof(BOOL), NULL));
// ggf. Moniker einlesen
BOOL fHasMoniker = TRUE;
if (dwVersion >= REGOPERATPROPACT_VERSION_1_0_2) {
RETURN_FAILED_HRESULT (pStm->Read (&fHasMoniker, sizeof(BOOL), NULL));
}
if (fHasMoniker) {
RETURN_FAILED_HRESULT (OleLoadFromStream(pStm, IID_IMoniker, m_mkOperOptions.ppv()));
}
if (NULL == m_pRegOperDlg)
// Initialisierungsdaten für den Dialog wurden zwar soeben von Load() bereitgestellt,
// können hier aber noch nicht an diesen weitergereicht werden
m_bHasInitData = true;
else
// Initialisierungsdaten an den Dialog weiterreichen
m_pRegOperDlg->SetSelectedInfo (&m_caSelInfo);
m_bIsInitialized = true; // Page wurde jetzt durch Load() initialisiert
m_bIsDirty = false; // Dialogparameter wurden (noch) nicht verändert
return S_OK;
} // Load
示例11: IMyPersistStreamImpl_Load
STDMETHODIMP CPoint::IMyPersistStreamImpl_Load(LPSTREAM pIStream)
{
ULONG cb;
HRESULT hr;
if (NULL==pIStream)
return ResultFromScode(E_POINTER);
//
// Read an object from the stream.
//
hr=pIStream->Read(&m_Point, sizeof(POINT), &cb);
if (FAILED(hr))
return hr;
if (sizeof(POINT) != cb)
return E_FAIL;
return NOERROR;
}
示例12: _AfxGetClassIDFromStreamedPropset
BOOL AFXAPI _AfxGetClassIDFromStreamedPropset(LPCLSID lpClsid, LPSTREAM lpStream)
{
BOOL bSuccess = FALSE;
ULARGE_INTEGER uliSave;
LARGE_INTEGER liClsidOffset;
LISet32(liClsidOffset, 8);
if (SUCCEEDED(lpStream->Seek(_afxLargeZero, STREAM_SEEK_CUR, &uliSave)))
{
if (SUCCEEDED(lpStream->Seek(liClsidOffset, STREAM_SEEK_CUR, NULL)) &&
SUCCEEDED(lpStream->Read(lpClsid, sizeof(CLSID), NULL)))
{
bSuccess = TRUE;
}
lpStream->Seek(*(LARGE_INTEGER*)&uliSave, STREAM_SEEK_SET, NULL);
}
return bSuccess;
}
示例13: GetLargeStringProperty
BOOL CMapiApi::GetLargeStringProperty( LPMAPIPROP pProp, ULONG tag, nsCString& val)
{
LPSTREAM lpStream;
HRESULT hr = pProp->OpenProperty( tag, &IID_IStream, 0, 0, (LPUNKNOWN *)&lpStream);
if (HR_FAILED( hr))
return( FALSE);
STATSTG st;
BOOL bResult = TRUE;
hr = lpStream->Stat( &st, STATFLAG_NONAME);
if (HR_FAILED( hr))
bResult = FALSE;
else {
if (!st.cbSize.QuadPart)
st.cbSize.QuadPart = 1;
char *pVal = new char[ (int) st.cbSize.QuadPart + 1];
// val.SetCapacity( (int) st.cbSize.QuadPart);
if (pVal) {
ULONG sz;
hr = lpStream->Read( pVal, (ULONG) st.cbSize.QuadPart, &sz);
if (HR_FAILED( hr)) {
bResult = FALSE;
*pVal = 0;
sz = 0;
}
else
pVal[(int) st.cbSize.QuadPart] = 0;
val = pVal;
delete [] pVal;
}
else
bResult = FALSE;
}
lpStream->Release();
return( bResult);
}
示例14: _AfxSaveStreamDataAsBlobProp
BOOL AFXAPI _AfxSaveStreamDataAsBlobProp(LPSTREAM pstm, CPropertySection& psec,
DWORD dwPropID, DWORD dwType)
{
BOOL bSuccess = FALSE;
ULARGE_INTEGER uliStart;
ULARGE_INTEGER uliEnd;
// Note: Stream length must fit in a DWORD.
if (SUCCEEDED(pstm->Seek(_afxLargeZero, STREAM_SEEK_CUR, &uliStart)) &&
SUCCEEDED(pstm->Seek(_afxLargeZero, STREAM_SEEK_END, &uliEnd)) &&
SUCCEEDED(pstm->Seek(*(LARGE_INTEGER*)&uliStart, STREAM_SEEK_SET,
NULL)))
{
DWORD cb = uliEnd.LowPart - uliStart.LowPart;
HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE|GMEM_SHARE,
cb + (DWORD)sizeof(cb));
if (hGlobal != NULL)
{
LPBYTE pbData = (LPBYTE)GlobalLock(hGlobal);
if (pbData != NULL)
{
*(DWORD*)pbData = cb;
if (SUCCEEDED(pstm->Read(pbData + (DWORD)sizeof(DWORD), cb,
NULL)))
{
bSuccess = psec.Set(dwPropID, pbData, dwType);
}
GlobalUnlock(hGlobal);
}
GlobalFree(hGlobal);
}
}
return bSuccess;
}
示例15: ResultFromScode
FARINTERNAL UtGetHMFPICTFromMSDrawNativeStm
(LPSTREAM pstm, DWORD dwSize, HANDLE FAR* lphdata)
{
HRESULT error;
WORD mfp[3]; // mm, xExt, yExt
HMETAFILE hMF = NULL;
*lphdata = NULL;
if (error = pstm->Read(mfp, sizeof(mfp), NULL))
return error;
dwSize -= sizeof(mfp);
if (error = UtGetHMFFromMFStm(pstm, dwSize, FALSE, (void **)&hMF))
return error;
AssertSz(mfp[0] == MM_ANISOTROPIC, "invalid map mode in MsDraw native data");
if (*lphdata = UtGetHMFPICT(hMF, TRUE, (int) mfp[1], (int) mfp[2]))
return NOERROR;
return ResultFromScode(E_OUTOFMEMORY);
}