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


C++ LPSTREAM::Write方法代码示例

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


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

示例1: 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

示例2: Save

STDMETHODIMP CValueAxis::Save(LPSTREAM pStm, BOOL fClearDirty)
{
	pStm->Write(&m_iWholeDigits, sizeof(int), NULL);
	pStm->Write(&m_iDecimalDigits, sizeof(int), NULL);

	pStm->Write(&m_dMinVal, sizeof(double), NULL);
	pStm->Write(&m_dMaxVal, sizeof(double), NULL);

	return CAxis::Save(pStm, fClearDirty);
}
开发者ID:JackWangCUMT,项目名称:SuperCxHMI,代码行数:10,代码来源:Axis.cpp

示例3:

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

示例4: 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

示例5: SetNotes

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

示例6: Save

STDMETHODIMP CGrid::Save(LPSTREAM pStm, BOOL fClearDirty)
{
    pStm->Write(&m_bShowVertical, sizeof(m_bShowVertical), NULL);
    pStm->Write(&m_bShowHorizontal, sizeof(m_bShowHorizontal), NULL);
    pStm->Write(&m_lNumberOfVerticalLines, sizeof(m_lNumberOfVerticalLines), NULL);
    pStm->Write(&m_lNumberOfHorizontalLines, sizeof(m_lNumberOfHorizontalLines), NULL);
    pStm->Write(&m_enumVerticalStyle, sizeof(m_enumVerticalStyle), NULL);
    pStm->Write(&m_enumHorizontalStyle, sizeof(m_enumHorizontalStyle), NULL);
    pStm->Write(&m_nWidth, sizeof(m_nWidth), NULL);
    pStm->Write(&m_clrVerticalColor, sizeof(m_clrVerticalColor), NULL);
    pStm->Write(&m_clrHorizontalColor, sizeof(m_clrHorizontalColor), NULL);

    return S_OK;
}
开发者ID:eseawind,项目名称:SuperCxHMI,代码行数:14,代码来源:Grid.cpp

示例7: IPersistStreamInit_Save

HRESULT CGifSmileyCtrl::IPersistStreamInit_Save(LPSTREAM pStm, BOOL fClearDirty,const ATL_PROPMAP_ENTRY* pMap)
{
	INFO_GIF infoGif;;
	wsprintf(infoGif.filePath, m_strFilename.GetBuffer());
	infoGif.hwndFrom = (LONG)m_hwndParent;
	infoGif.clrBackground = m_clrBackColor;
	pStm->Write(&infoGif, sizeof(INFO_GIF),NULL);
	return IPersistStreamInitImpl<CGifSmileyCtrl>::IPersistStreamInit_Save( pStm, fClearDirty, pMap);
}
开发者ID:0359xiaodong,项目名称:TeamTalk,代码行数:9,代码来源:GifSmileyCtrl.cpp

示例8: DoSave

HRESULT CDrawMenu::DoSave(DWORD dwVer, LPSTREAM pStm)
{
	pStm->Write(&m_bButtonDisplayed, sizeof(m_bButtonDisplayed), NULL);
	m_bstrButtonCaption.WriteToStream(pStm);

	int nCount = m_arrItems.GetSize();
	pStm->Write(&nCount, sizeof(nCount), NULL);
	for (int i = 0; i < nCount; i++)
	{
		CMenuItem& item = m_arrItems[i];
		item.m_bstrText.WriteToStream(pStm);
		pStm->Write(&item.m_dwState, sizeof(DWORD), NULL);
		if (dwVer > _SUPERCX_VER_0203)
		{
			item.m_bstrID.WriteToStream(pStm);
			pStm->Write(&item.m_dwShiftState, sizeof(DWORD), NULL);
			pStm->Write(&item.m_dwKeyCode, sizeof(DWORD), NULL);
		}
	}
	
	pStm->Write(&m_rcPosition, sizeof(m_rcPosition), NULL);

	m_bstrDescription.WriteToStream(pStm);
	
	return CCxDrawObjectBase::DoSave(dwVer, pStm);
}
开发者ID:JackWangCUMT,项目名称:SuperCxHMI,代码行数:26,代码来源:DrawMenu.cpp

示例9: SaveOldVer

STDMETHODIMP CDrawTxt::SaveOldVer(LPSTREAM pStm, BOOL fClearDirty)
{
//	pStm->Write(&m_bAutoSize, sizeof(BOOL), NULL);
	pStm->Write(&m_dFontHeight, sizeof(double), NULL);
	pStm->Write(&m_dFontWidth, sizeof(double), NULL);
	pStm->Write(&m_lWeight, sizeof(long), NULL);
	pStm->Write(&m_bItalic, sizeof(BOOL), NULL);
	pStm->Write(&m_bUnderLine, sizeof(BOOL), NULL);
	pStm->Write(&m_bStrikethrough, sizeof(BOOL), NULL);
	m_bstrFontName.WriteToStream(pStm);
	m_bstrCaption.WriteToStream(pStm);
	pStm->Write(&m_clrForeColor, sizeof(OLE_COLOR), NULL);
	pStm->Write(&m_clrBackColor, sizeof(OLE_COLOR), NULL);
	pStm->Write(&m_nTextAlign, sizeof(UINT), NULL);
	pStm->Write(&m_bsBackStyle, sizeof(enumBackStyle), NULL);
	pStm->Write(&m_rcPosition, sizeof(RECTF), NULL);
	
	return ICxDrawObjectImpl<CDrawTxt>::SaveOldVer(pStm, fClearDirty);
}
开发者ID:JackWangCUMT,项目名称:SuperCxHMI,代码行数:19,代码来源:DrawTxt.cpp

示例10: Save

// --------------------------------------------------------------------------------------------
// fClearDirty: Zustand im aktuellen Projekt und dessen Abspeicherung ist identisch (true) bzw.
//              stimmt nicht überein (false); letzterer Fall tritt bei SaveAs() auf
STDMETHODIMP CRegOperatPropAct::Save (LPSTREAM pStm, BOOL fClearDirty)
{
// Bezeichner wegschreiben
HRESULT hr = CPropertyAction::Save (pStm, fClearDirty);

	if (FAILED(hr)) return hr;

// Signatur und Version wegschreiben
DWORD dwSignature = REGOPERATPROPACT_SIGNATURE;
DWORD dwVersion = REGOPERATPROPACT_VERSION_1_0_2;

	RETURN_FAILED_HRESULT (pStm->Write (&dwSignature, sizeof(DWORD), NULL));
	RETURN_FAILED_HRESULT (pStm->Write (&dwVersion, sizeof(DWORD), NULL));

// dann selektierte Info der letzten Auswahl
	// nachfolgende if-Bedingung für den Fall, daß m_pRegOperDlg-Seite "am Schluß" nicht oben
	// lag, also BeginAction() und damit auch GetSelectedInfo() nicht ausgeführt wurden
	if (m_pRegOperDlg)
		m_pRegOperDlg->GetSelectedInfo (&m_caSelInfo, m_bIsDirty);

	RETURN_FAILED_HRESULT (pStm->Write (&m_caSelInfo.bClassKey, sizeof(BOOL), NULL));
	RETURN_FAILED_HRESULT (pStm->Write (&m_caSelInfo.bInter, sizeof(BOOL), NULL));
	RETURN_FAILED_HRESULT (pStm->Write (&m_caSelInfo.bExter, sizeof(BOOL), NULL));
	RETURN_FAILED_HRESULT (pStm->Write (&m_caSelInfo.bBound, sizeof(BOOL), NULL));

	if (!m_mkOperOptions.IsValid() && m_wOperOptions.IsValid()) {
	// ggf. Moniker geben lassen
		RETURN_FAILED_HRESULT (MkGetMoniker(m_wOperOptions, 
			OLEGETMONIKER_FORCEASSIGN, OLEWHICHMK_OBJFULL, m_mkOperOptions.ppi()));
	}

// und Moniker wegschreiben
BOOL fHasMoniker;

	if (m_mkOperOptions.IsValid()) {
		fHasMoniker = TRUE;
		RETURN_FAILED_HRESULT (pStm->Write (&fHasMoniker, sizeof(BOOL), NULL));
		RETURN_FAILED_HRESULT (OleSaveToStream(WPersistStream(m_mkOperOptions), pStm));
	}
	else {
		fHasMoniker = FALSE;
		RETURN_FAILED_HRESULT (pStm->Write (&fHasMoniker, sizeof(BOOL), NULL));
	}

	if (fClearDirty) m_bIsDirty = false;
	return S_OK;

} // Save
开发者ID:hkaiser,项目名称:TRiAS,代码行数:51,代码来源:RegOperatPropAct.cpp

示例11: IMyPersistStreamImpl_Save

STDMETHODIMP CPoint::IMyPersistStreamImpl_Save(LPSTREAM pIStream, BOOL /*fClearDirty */)
{
    ULONG           cb;
    HRESULT         hr;

    if (NULL==pIStream)
        return ResultFromScode(E_POINTER);

    //
    // Write the object into the stream.
    //
    hr=pIStream->Write(&m_Point, (ULONG)sizeof(POINT), &cb);

    if (FAILED(hr) || sizeof(POINT)!=cb)
       return ResultFromScode(STG_E_WRITEFAULT);

	return NOERROR;
}
开发者ID:Essjay1,项目名称:Windows-classic-samples,代码行数:18,代码来源:Point.Cpp

示例12: _AfxInitStreamDataFromBlobProp

BOOL AFXAPI _AfxInitStreamDataFromBlobProp(LPSTREAM pstm, CProperty* pprop)
{
	BOOL bSuccess = FALSE;
	ULONG cb;
	BYTE* pbData = (BYTE*)(pprop->Get(&cb));

	if (pbData != NULL)
	{
		// Put the data into the stream, then seek back to start of data.

		LARGE_INTEGER liOffset;
		liOffset.LowPart = -(LONG)cb;
		liOffset.HighPart = -1;
		if (SUCCEEDED(pstm->Write(pbData + sizeof(ULONG), cb, NULL)) &&
			SUCCEEDED(pstm->Seek(liOffset, STREAM_SEEK_CUR, NULL)))
		{
			bSuccess = TRUE;
		}
	}

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

示例13: ReadDirectory

void ReadDirectory(const char* szPath, LPSTORAGE pStg)
{
    // recursive function
    USES_CONVERSION;
    WIN32_FIND_DATA fData;
    HANDLE h;
    char szNewPath[MAX_PATH];
    char szStorageName[100];
    char szStreamName[100];
	char szData[81];
    char* pch = NULL;

    LPSTORAGE pSubStg = NULL;
    LPSTREAM pStream = NULL;

    g_nIndent++;
    strcpy(szNewPath, szPath);
    strcat(szNewPath, "*.*");
    h = ::FindFirstFile(szNewPath, &fData);
    if (h == (HANDLE) 0xFFFFFFFF) return;  // can't find directory
    do {
      if (!strcmp(fData.cFileName, "..") ||
          !strcmp(fData.cFileName, ".") ) continue;
	  while((pch = strchr(fData.cFileName, '!')) != NULL) {
	      *pch = '|';
	  }
      if (fData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
		// It's a directory, so make a storage
        strcpy(szNewPath, szPath);
        strcat(szNewPath,fData.cFileName);
        strcat(szNewPath, "\\");

        strcpy(szStorageName, fData.cFileName);
        szStorageName[31] = '\0';    // limit imposed by OLE
        TRACE("%0.*sStorage = %s\n", (g_nIndent - 1) * 4,
              g_szBlanks, szStorageName);
        VERIFY(pStg->CreateStorage(T2COLE(szStorageName),
            STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE,
            0, 0, &pSubStg) == S_OK);
        ASSERT(pSubStg != NULL);
        ReadDirectory(szNewPath, pSubStg);
        pSubStg->Release();
      }
      else {
        if ((pch = strrchr(fData.cFileName, '.')) != NULL) {
          if (!stricmp(pch, ".TXT")) {
			// It's a text file, so make a stream
			strcpy(szStreamName, fData.cFileName);
            strcpy(szNewPath, szPath);
            strcat(szNewPath, szStreamName);
 			szStreamName[32] = '\0'; // OLE max length
            TRACE("%0.*sStream = %s\n", (g_nIndent - 1) * 4,
                g_szBlanks, szNewPath);
			CStdioFile file(szNewPath, CFile::modeRead);
            // Ignore zero-length files
			if(file.ReadString(szData, 80)) {
              TRACE("%s\n", szData);
              VERIFY(pStg->CreateStream(T2COLE(szStreamName),
                     STGM_CREATE | STGM_READWRITE | 
				     STGM_SHARE_EXCLUSIVE,
                     0, 0, &pStream) == S_OK);
              ASSERT(pStream != NULL);
			  // Include the null terminator in the stream
              pStream->Write(szData, strlen(szData) + 1, NULL);
              pStream->Release();
            }
          }
        }
      }
    } while (::FindNextFile(h, &fData));
    g_nIndent--;
}
开发者ID:jiayuehua,项目名称:InsideVC,代码行数:72,代码来源:WriteThread.cpp

示例14: DoSave

HRESULT CDrawTxt::DoSave(DWORD dwVer, LPSTREAM pStm)
{
	pStm->Write(&m_enumMousePointer, sizeof(m_enumMousePointer), NULL);
	m_bstrDescription.WriteToStream(pStm);
	pStm->Write(&m_dFontHeight, sizeof(double), NULL);
	pStm->Write(&m_dFontWidth, sizeof(double), NULL);
	pStm->Write(&m_lWeight, sizeof(long), NULL);
	pStm->Write(&m_bItalic, sizeof(BOOL), NULL);
	pStm->Write(&m_bUnderLine, sizeof(BOOL), NULL);
	pStm->Write(&m_bStrikethrough, sizeof(BOOL), NULL);
	m_bstrFontName.WriteToStream(pStm);
	m_bstrCaption.WriteToStream(pStm);
	pStm->Write(&m_clrForeColor, sizeof(OLE_COLOR), NULL);
	pStm->Write(&m_clrBackColor, sizeof(OLE_COLOR), NULL);
	pStm->Write(&m_nTextAlign, sizeof(UINT), NULL);
	pStm->Write(&m_bsBackStyle, sizeof(enumBackStyle), NULL);
	pStm->Write(&m_rcPosition, sizeof(RECTF), NULL);

	if (dwVer > _SUPERCX_VER_0207)
	{
		pStm->Write(&m_bAutoSize, sizeof(BOOL), NULL);
		pStm->Write(&m_bWordWrap, sizeof(BOOL), NULL);
	}

	return CCxDrawObjectBase::DoSave(dwVer, pStm);
}
开发者ID:JackWangCUMT,项目名称:SuperCxHMI,代码行数:26,代码来源:DrawTxt.cpp

示例15: Save

STDMETHODIMP CDirectDynamic::Save(LPSTREAM pStm, BOOL fClearDirty)
{
	m_bstrSource.WriteToStream(pStm);
	pStm->Write(&m_bEnableMouseInput, sizeof(m_bEnableMouseInput), NULL);
	return S_OK;
}
开发者ID:JackWangCUMT,项目名称:SuperCxHMI,代码行数:6,代码来源:DirectDynamic.cpp


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