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


C++ COleDataObject::AttachClipboard方法代码示例

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


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

示例1: COleDialog

COlePasteSpecialDialog::COlePasteSpecialDialog(DWORD dwFlags,
	COleDataObject* pDataObject, CWnd* pParentWnd) : COleDialog(pParentWnd)
{
	memset(&m_ps, 0, sizeof(m_ps)); // initialize structure to 0/NULL

	// fill in common part
	m_ps.cbStruct = sizeof(m_ps);
	m_ps.dwFlags = dwFlags | PSF_STAYONCLIPBOARDCHANGE;
	if (!afxData.bWin4 && AfxHelpEnabled())
		m_ps.dwFlags |= PSF_SHOWHELP;
	if (_AfxOlePropertiesEnabled())
		m_ps.dwFlags |= PSF_HIDECHANGEICON;
	m_ps.lpfnHook = AfxOleHookProc;
	m_nIDHelp = AFX_IDD_PASTESPECIAL;

	// get LPDATAOBJECT for paste special dialog
	COleDataObject dataObject;
	if (pDataObject == NULL)
	{
		VERIFY(dataObject.AttachClipboard());
		pDataObject = &dataObject;
	}
	ASSERT(pDataObject != NULL);
	m_ps.lpSrcDataObj = pDataObject->GetIDataObject(TRUE);

	// complete initialization
	m_ps.arrPasteEntries = NULL;
	m_ps.cPasteEntries = 0;
	m_ps.arrLinkTypes = m_arrLinkTypes;
	m_ps.cLinkTypes = 0;
}
开发者ID:rickerliang,项目名称:OpenNT,代码行数:31,代码来源:oledlgs1.cpp

示例2: CanPaste

bool CMyStatic::CanPaste() const
{
	bool bRet = false;
	COleDataObject DataObj;
	if (DataObj.AttachClipboard())
		bRet = (DropType::DropNothing != GetDropType(&DataObj));
	return bRet;
}
开发者ID:halx99,项目名称:OleDataDemo,代码行数:8,代码来源:MyStatic.cpp

示例3: Paste

//-------------------------------------------------------------------//
// Paste()																				//
//-------------------------------------------------------------------//
void OleListCtrl::Paste( 
	PASTEMODE ePasteMode 
) {
	COleDataObject DataObject;

	if ( DataObject.AttachClipboard() )
	{
		// Unarchive the data into the DragData array.
		ExtractDropData( 
			&DataObject
		);

		// This allows us to manipulate the drag data 
		// before we add it as new list items.
		ProcessNewDragData( 
			DROPEFFECT_MOVE	// dropEffect
		);

		// PASTE_REPLACE_ALL, PASTE_TOP default.
		int nUnderCursor = 0;

		switch( ePasteMode )
		{
			case PASTE_BOTTOM:
				nUnderCursor = GetItemCount();
				break;
			case PASTE_REPLACE_ALL:
				DeleteAllItems();
				break;
			case PASTE_AT_SELECTION:
				nUnderCursor = GetNextItem( -1, LVNI_FOCUSED );
				if ( nUnderCursor == -1 )
					nUnderCursor = GetItemCount();
				break;
			default:
				break;
		}

		if (
			AddItemsFromDragData( 
				nUnderCursor,
				false				// bInsertAfter
			)
		) {
			// If we added anything we need to redraw.  This may also
			// e.g. update the caption and icon and mark the list "dirty"
			// in derived classes.
			UpdateAfterDrop( nUnderCursor, true );
		}
		
		// Clear the drag contents, now that we have added them.
		// Don't worry, the clipboard hasn't changed, in case we
		// wanted to add the items again!  :>
		Items.RemoveAll();

	}
}
开发者ID:moodboom,项目名称:Reusable,代码行数:60,代码来源:OleListCtrl.cpp

示例4:

void CEx27bView::OnUpdateEditPaste(CCmdUI* pCmdUI) 
{
    // Make sure that object data is available
	COleDataObject dataObject;
	if (dataObject.AttachClipboard() &&
    	dataObject.IsDataAvailable(m_cfEmbedded)) {
        pCmdUI->Enable(TRUE);
    } else {
    	pCmdUI->Enable(FALSE);
    }
}
开发者ID:jiayuehua,项目名称:InsideVC,代码行数:11,代码来源:ex27bView.cpp

示例5: GetDocument

void CEx27bView::OnEditPaste() 
{
	CEx27bDoc* pDoc = GetDocument();
	COleDataObject dataObject;
	VERIFY(dataObject.AttachClipboard());
	pDoc->DeleteContents();
	DoPasteObjectDescriptor(&dataObject);
	DoPasteObject(&dataObject);
	SetViewAdvise();
	GetSize();
	pDoc->SetModifiedFlag();
	pDoc->UpdateAllViews(NULL);
}
开发者ID:jiayuehua,项目名称:InsideVC,代码行数:13,代码来源:ex27bView.cpp

示例6: OnUpdatePaste

//-------------------------------------------------------------------//
// OnUpdatePaste()																	//
//-------------------------------------------------------------------//
// Disable paste if nothing's available.
// Nice of MultiColumnSortListCtrl::DisplayRightClickMenu() to
// force checks for ON_UPDATE_COMMAND_UI's.
//-------------------------------------------------------------------//
void OleListCtrl::OnUpdatePaste(CCmdUI* pCmdUI) 
{
	bool bHaveData = false;

	COleDataObject DataObject;
	if ( DataObject.AttachClipboard() )
	{
		// Do we have OLE data in the DragData array?
		bHaveData = bHaveValidDropData( &DataObject );
	}

	pCmdUI->Enable( bHaveData );
}
开发者ID:moodboom,项目名称:Reusable,代码行数:20,代码来源:OleListCtrl.cpp

示例7: OkToPaste

///////////////////////////////////////////////////
// Verify that data you can handle is on the clipboard.
///////////////////////////////////////////////////
BOOL CDragDropMgr::OkToPaste()
{
    COleDataObject obj;

    BOOL bOk = FALSE;

    if (!obj.AttachClipboard())
        return FALSE;
    
    for (int i=0;i < m_nFormats.GetSize() && !bOk;i++)
    {
        UINT nF = m_nFormats.GetAt(i);
        bOk = obj.IsDataAvailable(m_nFormats.GetAt(i));
    }

    return bOk;
}
开发者ID:aolko,项目名称:construct,代码行数:20,代码来源:ddmgr.cpp

示例8: ClipToPocket

void COXMulticlipboardDlg::ClipToPocket(COXClipPocket *pPocket)
{
	//the function opens clipboard and
	//calls virtual ClipObjectToPocket()
	//to make copy of the clipboard data
	ASSERT(pPocket);

	COleDataObject clipobj;

	if (!clipobj.AttachClipboard())
	{
		TRACE0("CMulticlipboardDlg::ClipToPocket : Failed to attach to clipboard\r\n");
		return;
	}

	ClipObjectToPocket(pPocket, &clipobj);
}
开发者ID:Spritutu,项目名称:AiPI-1,代码行数:17,代码来源:OXMulticlipboardDlg.cpp

示例9: OnEditPaste

void CHexEdit::OnEditPaste() 
{
	COleDataObject	obj;	
	if (obj.AttachClipboard()) 
	{
		HGLOBAL hmem = NULL;
		if (obj.IsDataAvailable(RegisterClipboardFormat("BinaryData"))) 
		{
			hmem = obj.GetGlobalData(RegisterClipboardFormat("BinaryData"));
		}	
		else if (obj.IsDataAvailable(CF_TEXT)) 
		{
			hmem = obj.GetGlobalData(CF_TEXT);
		}
		if(hmem)
		{
			LPBYTE	p = (BYTE*)::GlobalLock(hmem);
			DWORD	dwSizeMem=::GlobalSize(hmem);
			DWORD	dwSizeSel=GetSelLength();
			DWORD	dwLen =dwSizeMem>dwSizeSel?dwSizeSel:dwSizeMem;
			int		insert;
			
			NormalizeSel();
			if(m_selStart == 0xffffffff)
			{
				if(m_currentMode == EDIT_LOW)
					m_currentAddress++;
				insert = m_currentAddress;
				SelInsert(m_currentAddress, dwLen);
			}
			else
			{
				insert = m_selStart;
				SelDelete(m_selStart,m_selStart+dwLen-1);
				SelInsert(insert, dwLen);
			}
			memcpy(m_pData+insert, p, dwLen);
			
			m_currentAddress = insert+dwLen;
//			RepositionCaret(m_currentAddress);
			ResetPos();
			Invalidate(FALSE);
			::GlobalUnlock(hmem);
		}
	}
}
开发者ID:YangJinWen,项目名称:H264BSAnalyzer,代码行数:46,代码来源:hexeditctrl.cpp

示例10: OnEditPaste

void CHexEdit::OnEditPaste() 
{
	COleDataObject	obj;	
	if (obj.AttachClipboard()) 
	{
		HGLOBAL hmem = NULL;
		if (obj.IsDataAvailable(RegisterClipboardFormat(L"BinaryData"))) 
		{
			hmem = obj.GetGlobalData(RegisterClipboardFormat(L"BinaryData"));
		}	
		else if (obj.IsDataAvailable(CF_TEXT)) 
		{
			hmem = obj.GetGlobalData(CF_TEXT);
		}
		if(hmem)
		{
			LPBYTE	p = (BYTE*)::GlobalLock(hmem);
			DWORD	dwLen = ::GlobalSize(hmem);
			int		insert;
			int		oa = m_currentAddress;
			
			NormalizeSel();
			if(m_selStart == 0xffffffff)
			{
				if(m_currentMode == EDIT_LOW)
					m_currentAddress++;
				insert = m_currentAddress;
				SelInsert(m_currentAddress, dwLen);
			}
			else
			{
				insert = m_selStart;
				SelDelete(m_selStart, m_selEnd);
				SelInsert(insert, dwLen);
				SetSel(-1, -1);
			}

			memcpy(m_pData+insert, p, dwLen);

			m_currentAddress = oa;
			RedrawWindow();
			::GlobalUnlock(hmem);
		}
	}
}
开发者ID:Garfield-Chen,项目名称:openlibs,代码行数:45,代码来源:HexEdit.cpp

示例11: OnContextMenu

void CHexEdit::OnContextMenu(CWnd*, CPoint point)
{
    // by latelee
	#if 0
	// CG: This block was added by the Pop-up Menu component
	{
		if (point.x == -1 && point.y == -1)
		{
			//keystroke invocation
			CRect rect;
			GetClientRect(rect);
			ClientToScreen(rect);
			
			point = rect.TopLeft();
			point.Offset(5, 5);
		}
		
		CMenu menu;
		VERIFY(menu.LoadMenu(CG_IDR_POPUP_HEX_EDIT));
		
		CMenu* pPopup = menu.GetSubMenu(0);
		ASSERT(pPopup != NULL);
		
		pPopup->EnableMenuItem(ID_EDIT_UNDO, MF_GRAYED|MF_DISABLED|MF_BYCOMMAND);
		if(!IsSelected())
		{
			pPopup->EnableMenuItem(ID_EDIT_CLEAR, MF_GRAYED|MF_DISABLED|MF_BYCOMMAND);
			pPopup->EnableMenuItem(ID_EDIT_CUT, MF_GRAYED|MF_DISABLED|MF_BYCOMMAND);
			pPopup->EnableMenuItem(ID_EDIT_COPY, MF_GRAYED|MF_DISABLED|MF_BYCOMMAND);
		}
		{
			COleDataObject	obj;	
			if (obj.AttachClipboard()) 
			{
				if(!obj.IsDataAvailable(CF_TEXT) && !obj.IsDataAvailable(RegisterClipboardFormat("BinaryData")))
					pPopup->EnableMenuItem(ID_EDIT_PASTE, MF_GRAYED|MF_DISABLED|MF_BYCOMMAND);
			}
		}
		
		pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y,
			this);
	}
    #endif
}
开发者ID:YangJinWen,项目名称:H264BSAnalyzer,代码行数:44,代码来源:hexeditctrl.cpp

示例12: tools_getClipboardText

	bool zstringEx::tools_getClipboardText()
	{    
		COleDataObject obj;

		if (obj.AttachClipboard()) 
		{
				if (obj.IsDataAvailable(CF_TEXT)) 
				{
					HGLOBAL hmem = obj.GetGlobalData(CF_TEXT);                  
					CMemFile sf((BYTE*) ::GlobalLock(hmem), (UINT)::GlobalSize(hmem));
					mem_data.mem_resizenull((UINT)::GlobalSize(hmem));
					sf.Read(mem_data.mem_string, (UINT)::GlobalSize(hmem));
					::GlobalUnlock(hmem);
					sf.Close();	
					return true;
				}
		}
		return false;
	}
开发者ID:Leoyuseu,项目名称:CodeHub,代码行数:19,代码来源:zstringEx.cpp

示例13: OnEditPaste

void CUIDesignerView::OnEditPaste()
{
	COleDataObject dataObject;
	dataObject.AttachClipboard();

	if(dataObject.IsDataAvailable(m_cfUI))
	{
		CFile* pFile = dataObject.GetFileData(m_cfUI);
		if (pFile == NULL)
			return;

		int len = (int)pFile->GetLength();
		char* pstrXML  = new char[len];
		pFile->Read(pstrXML, len);

		PasteUI(StringConvertor::Utf8ToWide(pstrXML));

		delete[] pstrXML;
		delete pFile;
	}
}
开发者ID:pyq881120,项目名称:urltraveler,代码行数:21,代码来源:UIDesignerView.cpp

示例14: Paste

void kGUISystemWin::Paste(kGUIString *s)
{
	COleDataObject	obj;

	if (obj.AttachClipboard())
	{
#if 0
		if (obj.IsDataAvailable(CF_UNICODETEXT))
		{
			HGLOBAL hmem = obj.GetGlobalData(CF_UNICODETEXT);
			CMemFile sf((BYTE*) ::GlobalLock(hmem),(UINT) ::GlobalSize(hmem));
			CString buffer;

			LPSTR str = buffer.GetBufferSetLength((int)::GlobalSize(hmem));
			sf.Read(str,(UINT) ::GlobalSize(hmem));
			::GlobalUnlock(hmem);

			s->SetEncoding(ENCODING_UTF8);
			s->SetString(buffer);
		}
		else if (obj.IsDataAvailable(CF_TEXT))
#else
		if (obj.IsDataAvailable(CF_TEXT))
#endif
		{
			HGLOBAL hmem = obj.GetGlobalData(CF_TEXT);
			CMemFile sf((BYTE*) ::GlobalLock(hmem),(UINT) ::GlobalSize(hmem));
			CString buffer;

			LPSTR str = buffer.GetBufferSetLength((int)::GlobalSize(hmem));
			sf.Read(str,(UINT) ::GlobalSize(hmem));
			::GlobalUnlock(hmem);

//			s->SetEncoding(ENCODING_UTF8);
			s->SetEncoding(ENCODING_8BIT);
			s->SetString(buffer);
		}
	}
}
开发者ID:CarlHuff,项目名称:kgui,代码行数:39,代码来源:kguipc.cpp

示例15: AvailableDataType

///////////////////////////////////////////////////
// Verify that data you can handle is on the clipboard
// or in the drop buffer data object.
//
// If checking the clipboard, set pDataObject to NULL.
///////////////////////////////////////////////////
CString CDragDropMgr::AvailableDataType(COleDataObject* pDataObject)
{
    COleDataObject obj;

    //Assume caller is checking the clipboard
    //because no OLE data object was passed in
    if (pDataObject == NULL)
    {
        pDataObject = &obj;

        if (!obj.AttachClipboard())
            return "";
    }
    
    CString csFormat = "";
    
    for (int i=0;i < m_nFormats.GetSize() && csFormat.IsEmpty();i++)
    {
        if (pDataObject->IsDataAvailable(m_nFormats.GetAt(i)))
            csFormat = m_csFormats.GetAt(i);
    }

    return csFormat;
}
开发者ID:aolko,项目名称:construct,代码行数:30,代码来源:ddmgr.cpp


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