Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

put more than one control to the clipboard

Hello
Today I can put one control to the clipboard, with the following code:

tagSTGMEDIUM * data;
data = new tagSTGMEDIUM;
COleDataSource* pData = new COleDataSource;
CNiPicture mypic;
mypic = m_cGraphCh1.ControlImage();

//done drawing
data->tymed = TYMED_ENHMF;
data->hEnhMetaFile = ::CopyEnhMetaFile(reinterpret_cast(mypic.Handle), NULL);
pData->CacheData( CF_ENHMETAFILE, data );
pData->SetClipboard();
delete data;

Is it possible to put more than one control to the clipboard or even the actually control.
Thanks for your help!
Phil
0 Kudos
Message 1 of 3
(3,198 Views)
No, the standard clipboard can only be used to hold one image or data buffer at a time. What you could do is write code to combine the metafiles for multiple controls before sending the metafile to the clipboard. The clipboard only support images and data so you can't put an actual ActiveX control in the clipboard.

Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 2 of 3
(3,198 Views)
You can't put an ActiveX control on the clipboard, but you can persist an ActiveX control and save its persisted state on the clipboard. Take a look at the IPersistStream COM interface. You could query the ActiveX control for IPersistStream, persist to a stream via IPersistStream::Save, then set the persisted stream to the STGMEDIUM pstm member, which is an IStream. When you wanted to paste, you could create a new control, query the ActiveX control for IPersistStream, then load the persisted state via IPersistStream::Load. If you wanted to save the persisted states of multiple ActiveX controls on the clipboard, you could create an IStorage, create a stream for each control that you wanted to persist and persist each control to a stream, then save the ISto
rage to the STGMEDIUM pstg member, which is an IStorage.

- Elton
0 Kudos
Message 3 of 3
(3,198 Views)