本文整理汇总了C#中STGMEDIUM类的典型用法代码示例。如果您正苦于以下问题:C# STGMEDIUM类的具体用法?C# STGMEDIUM怎么用?C# STGMEDIUM使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
STGMEDIUM类属于命名空间,在下文中一共展示了STGMEDIUM类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SetData
internal uint SetData(FORMATETC pformatetc, STGMEDIUM pmedium, bool release) {
return E_NOTIMPL;
}
开发者ID:nlhepler,项目名称:mono,代码行数:3,代码来源:Win32DnD.cs
示例2: STGMEDIUM
void IDataObject.GetData(FORMATETC[] fmt, STGMEDIUM[] m) {
STGMEDIUM retMedium = new STGMEDIUM();
if (fmt == null || fmt.Length < 1)
return;
foreach (DataCacheEntry e in this.entries) {
if (e.Format.cfFormat == fmt[0].cfFormat /*|| fmt[0].cfFormat == InternalNativeMethods.CF_HDROP*/) {
retMedium.tymed = e.Format.tymed;
// Caller must delete the memory.
retMedium.unionmember = DragDropHelper.CopyHGlobal(new IntPtr(e.Data));
break;
}
}
if (m != null && m.Length > 0)
m[0] = retMedium;
}
开发者ID:CforED,项目名称:Node.js-Tools-for-Visual-Studio,代码行数:19,代码来源:DataObject.cs
示例3:
void IDataObject.SetData(FORMATETC[] fmt, STGMEDIUM[] m, int fRelease) {
}
开发者ID:CforED,项目名称:Node.js-Tools-for-Visual-Studio,代码行数:2,代码来源:DataObject.cs
示例4:
int IVsSimpleObjectList2.GetClipboardFormat(uint index, uint grfFlags, FORMATETC[] pFormatetc, STGMEDIUM[] pMedium)
{
return VSConstants.E_NOTIMPL;
}
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:4,代码来源:LibraryNode.cs
示例5: STGMEDIUM
void IDataObject.GetData(FORMATETC[] fmt, STGMEDIUM[] m)
{
STGMEDIUM retMedium = new STGMEDIUM();
if(fmt == null || fmt.Length < 1)
return;
SafeGlobalAllocHandle copy = null;
foreach(DataCacheEntry e in this.entries)
{
if(e.Format.cfFormat == fmt[0].cfFormat /*|| fmt[0].cfFormat == InternalNativeMethods.CF_HDROP*/)
{
retMedium.tymed = e.Format.tymed;
// Caller must delete the memory.
copy = DragDropHelper.CopyHGlobal(e.Data);
retMedium.unionmember = copy.DangerousGetHandle();
break;
}
}
if (m != null && m.Length > 0)
{
m[0] = retMedium;
if (copy != null)
copy.SetHandleAsInvalid();
}
}
开发者ID:tunnelvisionlabs,项目名称:MPFProj10,代码行数:28,代码来源:DataObject.cs
示例6: CopyStgMedium
private static extern int CopyStgMedium(ref STGMEDIUM pcstgmedSrc, ref STGMEDIUM pstgmedDest);
开发者ID:applejian,项目名称:cyberduck,代码行数:1,代码来源:DragDropLib.cs
示例7: CopyMedium
/// <summary>
/// Creates a copy of the STGMEDIUM structure.
/// </summary>
/// <param name="medium">The data to copy.</param>
/// <returns>The copied data.</returns>
private STGMEDIUM CopyMedium(ref STGMEDIUM medium)
{
STGMEDIUM sm = new STGMEDIUM();
int hr = CopyStgMedium(ref medium, ref sm);
if (hr != 0)
throw Marshal.GetExceptionForHR(hr);
return sm;
}
开发者ID:applejian,项目名称:cyberduck,代码行数:14,代码来源:DragDropLib.cs
示例8: GetClipboardFormat
/// <summary>
/// Asks the given list item to renders a specific clipboard format that it supports.
/// </summary>
/// <param name="index"></param>
/// <param name="grfFlags"></param>
/// <param name="pFormatetc"></param>
/// <param name="pMedium"></param>
/// <returns></returns>
public int GetClipboardFormat(uint index, uint grfFlags, FORMATETC[] pFormatetc, STGMEDIUM[] pMedium)
{
return VSConstants.E_NOTIMPL;
}
开发者ID:IntranetFactory,项目名称:ndjango,代码行数:12,代码来源:ResultList.cs
示例9: STGMEDIUM
void IDataObject.GetData(FORMATETC[] fmt, STGMEDIUM[] m) {
STGMEDIUM retMedium = new STGMEDIUM();
foreach (DataCacheEntry e in this.entries) {
if (e.format.cfFormat == fmt[0].cfFormat) {
retMedium.tymed = e.format.tymed;
retMedium.unionmember = CopyHGlobal(e.data);
break;
}
}
m[0] = retMedium;
}
开发者ID:hesam,项目名称:SketchSharp,代码行数:13,代码来源:DataObject.cs
示例10: GetDataHere
public uint GetDataHere(ref FORMATETC pFormatetc, out STGMEDIUM pMedium)
{
Trace.WriteLine("GetDataHere");
pMedium = new STGMEDIUM();
return (uint)E_NOTIMPL;
}
开发者ID:minhnguyen31093,项目名称:Reminiscent,代码行数:8,代码来源:ExtendedRichTextBox.cs
示例11: SetData
public uint SetData(ref FORMATETC a, ref STGMEDIUM b, bool fRelease)
{
//mpFormatetc = pFormatectIn;
//mpmedium = pmedium;
Trace.WriteLine("SetData");
return (int)S_OK;
}
开发者ID:minhnguyen31093,项目名称:Reminiscent,代码行数:9,代码来源:ExtendedRichTextBox.cs
示例12: GetData
public uint GetData(ref FORMATETC pFormatetc, ref STGMEDIUM pMedium)
{
IntPtr hDst = mBitmap.GetHbitmap();
pMedium.tymed = (int)TYMED.TYMED_GDI;
pMedium.unionmember = hDst;
pMedium.pUnkForRelease = IntPtr.Zero;
return (uint)S_OK;
}
开发者ID:minhnguyen31093,项目名称:Reminiscent,代码行数:10,代码来源:ExtendedRichTextBox.cs
示例13: STGMEDIUM
void IDataObject.GetData(FORMATETC[] fmt, STGMEDIUM[] m)
{
STGMEDIUM retMedium = new STGMEDIUM();
if (fmt == null || fmt.Length < 1)
return;
foreach (DataCacheEntry e in this.entries)
{
if (e.format.cfFormat == fmt[0].cfFormat)
{
retMedium.tymed = e.format.tymed;
retMedium.unionmember = CopyHGlobal(new IntPtr(e.data));
break;
}
}
if (m != null && m.Length > 0)
m[0] = retMedium;
}
开发者ID:hesam,项目名称:SketchSharp,代码行数:20,代码来源:DataObject.cs
示例14: AddFormatAndMedium
private static bool AddFormatAndMedium(ClipboardFormats cfFormat, object data) {
STGMEDIUM medium;
FORMATETC format;
IntPtr hmem;
IntPtr hmem_ptr;
byte[] b;
switch(cfFormat) {
case ClipboardFormats.CF_TEXT: {
b = XplatUIWin32.StringToAnsi ((string)data);
hmem = XplatUIWin32.CopyToMoveableMemory (b);
break;
}
case ClipboardFormats.CF_UNICODETEXT: {
b = XplatUIWin32.StringToUnicode ((string)data);
hmem = XplatUIWin32.CopyToMoveableMemory (b);
break;
}
case ClipboardFormats.CF_HDROP: {
IEnumerator e;
StringBuilder sb;
long hmem_string_ptr;
IntPtr string_buffer;
int string_buffer_size;
sb = new StringBuilder();
// Make sure object is enumerable; otherwise
if ((data is string) || !(data is IEnumerable)) {
sb.Append(data.ToString());
sb.Append('\0');
sb.Append('\0');
} else {
e = ((IEnumerable)data).GetEnumerator();
while (e.MoveNext()) {
sb.Append(e.Current.ToString());
sb.Append('\0');
}
sb.Append('\0');
}
string_buffer = Marshal.StringToHGlobalUni(sb.ToString());
string_buffer_size = (int)XplatUIWin32.Win32GlobalSize(string_buffer);
// Write DROPFILES structure
hmem = XplatUIWin32.Win32GlobalAlloc(XplatUIWin32.GAllocFlags.GMEM_MOVEABLE | XplatUIWin32.GAllocFlags.GMEM_DDESHARE, 0x14 + string_buffer_size);
hmem_ptr = XplatUIWin32.Win32GlobalLock(hmem);
Marshal.WriteInt32(hmem_ptr, 0x14); // pFiles
Marshal.WriteInt32(hmem_ptr, 1 * Marshal.SizeOf(typeof(uint)), 0); // point.x
Marshal.WriteInt32(hmem_ptr, 2 * Marshal.SizeOf(typeof(uint)), 0); // point.y
Marshal.WriteInt32(hmem_ptr, 3 * Marshal.SizeOf(typeof(uint)), 0); // fNc
Marshal.WriteInt32(hmem_ptr, 4 * Marshal.SizeOf(typeof(uint)), 1); // fWide
hmem_string_ptr = (long)hmem_ptr;
hmem_string_ptr += 0x14;
XplatUIWin32.Win32CopyMemory(new IntPtr(hmem_string_ptr), string_buffer, string_buffer_size);
Marshal.FreeHGlobal(string_buffer);
XplatUIWin32.Win32GlobalUnlock(hmem_ptr);
break;
}
case ClipboardFormats.CF_DIB: {
b = XplatUIWin32.ImageToDIB((Image)data);
hmem = XplatUIWin32.CopyToMoveableMemory (b);
break;
}
default: {
hmem = IntPtr.Zero;
break;
}
}
if (hmem != IntPtr.Zero) {
medium = new STGMEDIUM();
medium.tymed = TYMED.TYMED_HGLOBAL;
medium.hHandle = hmem;
medium.pUnkForRelease = IntPtr.Zero;
DragMediums.Add(medium);
format = new FORMATETC();
format.ptd = IntPtr.Zero;
format.dwAspect = DVASPECT.DVASPECT_CONTENT;
format.lindex = -1;
format.tymed = TYMED.TYMED_HGLOBAL;
format.cfFormat = cfFormat;
DragFormats.Add(format);
return true;
}
return false;
}
开发者ID:nlhepler,项目名称:mono,代码行数:97,代码来源:Win32DnD.cs
示例15: GetDataHere
/// <summary>
/// Gets the specified data.
/// </summary>
/// <param name="format">The requested data format.</param>
/// <param name="medium">When the function returns, contains the requested data.</param>
/// <remarks>Differs from GetData only in that the STGMEDIUM storage is
/// allocated and owned by the caller.</remarks>
public void GetDataHere(ref FORMATETC format, ref STGMEDIUM medium)
{
// Locate the data
KeyValuePair<FORMATETC, STGMEDIUM> dataEntry;
if (GetDataEntry(ref format, out dataEntry))
{
STGMEDIUM source = dataEntry.Value;
medium = CopyMedium(ref source);
return;
}
// Didn't find it. Return an empty data medium.
medium = default(STGMEDIUM);
}
开发者ID:applejian,项目名称:cyberduck,代码行数:21,代码来源:DragDropLib.cs
示例16: NotImplementedException
void IDataObject.GetDataHere(FORMATETC[] fmt, STGMEDIUM[] m) {
throw new NotImplementedException();
}
开发者ID:hesam,项目名称:SketchSharp,代码行数:3,代码来源:DataObject.cs
示例17: SetData
/// <summary>
/// Sets data in the specified format into storage.
/// </summary>
/// <param name="formatIn">The format of the data.</param>
/// <param name="medium">The data.</param>
/// <param name="release">If true, ownership of the medium's memory will be transferred
/// to this object. If false, a copy of the medium will be created and maintained, and
/// the caller is responsible for the memory of the medium it provided.</param>
public void SetData(ref FORMATETC formatIn, ref STGMEDIUM medium, bool release)
{
// If the format exists in our storage, remove it prior to resetting it
foreach (KeyValuePair<FORMATETC, STGMEDIUM> pair in storage)
{
if ((pair.Key.tymed & formatIn.tymed) > 0
&& pair.Key.dwAspect == formatIn.dwAspect
&& pair.Key.cfFormat == formatIn.cfFormat)
{
STGMEDIUM releaseMedium = pair.Value;
ReleaseStgMedium(ref releaseMedium);
storage.Remove(pair);
break;
}
}
// If release is true, we'll take ownership of the medium.
// If not, we'll make a copy of it.
STGMEDIUM sm = medium;
if (!release)
sm = CopyMedium(ref medium);
// Add it to the internal storage
KeyValuePair<FORMATETC, STGMEDIUM> addPair = new KeyValuePair<FORMATETC, STGMEDIUM>(formatIn, sm);
storage.Add(addPair);
RaiseDataChanged(ref addPair);
}
开发者ID:applejian,项目名称:cyberduck,代码行数:36,代码来源:DragDropLib.cs
示例18: ReleaseStgMedium
private static extern void ReleaseStgMedium(ref STGMEDIUM pmedium);
开发者ID:applejian,项目名称:cyberduck,代码行数:1,代码来源:DragDropLib.cs
示例19: CopyStgMedium
void CopyStgMedium(IntPtr cfFormat, ref STGMEDIUM lpDest, ref STGMEDIUM lpSource) {
/* STGMEDIUM appears to be messed up...
if (lpDest.tymed == TYMED_NULL) {
Debug.Assert(lpSource.tymed != TYMED_NULL);
switch (lpSource.tymed) {
case TYMED_ENHMF:
case TYMED_HGLOBAL:
lpDest.tymed = lpSource.tymed;
lpDest.hGlobal = NULL;
break;
case TYMED_ISTREAM:
lpDest.pstm = lpSource.pstm;
lpDest.pstm.AddRef();
lpDest.tymed = TYMED_ISTREAM;
return TRUE;
case TYMED_ISTORAGE:
lpDest.pstg = lpSource.pstg;
lpDest.pstg.AddRef();
lpDest.tymed = TYMED_ISTORAGE;
return TRUE;
case TYMED_MFPICT: {
// copy LPMETAFILEPICT struct + embedded HMETAFILE
HGLOBAL hDest = ::CopyGlobalMemory(NULL, lpSource.hGlobal);
if (hDest == NULL)
return FALSE;
LPMETAFILEPICT lpPict = (LPMETAFILEPICT)::GlobalLock(hDest);
ASSERT(lpPict != NULL);
lpPict.hMF = ::CopyMetaFile(lpPict.hMF, NULL);
if (lpPict.hMF == NULL) {
::GlobalUnlock(hDest);
::GlobalFree(hDest);
return FALSE;
}
::GlobalUnlock(hDest);
// fill STGMEDIUM struct
lpDest.hGlobal = hDest;
lpDest.tymed = TYMED_MFPICT;
}
return TRUE;
case TYMED_GDI:
lpDest.tymed = TYMED_GDI;
lpDest.hGlobal = NULL;
break;
case TYMED_FILE: {
USES_CONVERSION;
lpDest.tymed = TYMED_FILE;
ASSERT(lpSource.lpszFileName != NULL);
UINT cbSrc = (int)ocslen(lpSource.lpszFileName);
LPOLESTR szFileName = (LPOLESTR)CoTaskMemAlloc(cbSrc*sizeof(OLECHAR));
lpDest.lpszFileName = szFileName;
if (szFileName == NULL)
return FALSE;
memcpy(szFileName, lpSource.lpszFileName, (cbSrc+1)*sizeof(OLECHAR));
return TRUE;
}
// unable to create + copy other TYMEDs
default:
return FALSE;
}
}
ASSERT(lpDest.tymed == lpSource.tymed);
switch (lpSource.tymed) {
case TYMED_HGLOBAL: {
HGLOBAL hDest = ::CopyGlobalMemory(lpDest.hGlobal,
lpSource.hGlobal);
if (hDest == NULL)
return FALSE;
lpDest.hGlobal = hDest;
}
return TRUE;
case TYMED_ISTREAM: {
ASSERT(lpDest.pstm != NULL);
ASSERT(lpSource.pstm != NULL);
// get the size of the source stream
STATSTG stat;
if (lpSource.pstm.Stat(&stat, STATFLAG_NONAME) != S_OK) {
// unable to get size of source stream
return FALSE;
}
ASSERT(stat.pwcsName == NULL);
// always seek to zero before copy
LARGE_INTEGER zero = { 0, 0 };
lpDest.pstm.Seek(zero, STREAM_SEEK_SET, NULL);
lpSource.pstm.Seek(zero, STREAM_SEEK_SET, NULL);
// copy source to destination
if (lpSource.pstm.CopyTo(lpDest.pstm, stat.cbSize,
NULL, NULL) != NULL) {
//.........这里部分代码省略.........
开发者ID:hesam,项目名称:SketchSharp,代码行数:101,代码来源:DataObject.cs
示例20: GetData
public static STGMEDIUM GetData(Microsoft.VisualStudio.OLE.Interop.IDataObject dataObject, ref FORMATETC fmtetc)
{
if (dataObject == null)
throw new ArgumentNullException("dataObject");
FORMATETC[] af = new FORMATETC[1];
af[0] = fmtetc;
STGMEDIUM[] sm = new STGMEDIUM[1];
dataObject.GetData(af, sm);
fmtetc = af[0];
return sm[0];
}
开发者ID:tunnelvisionlabs,项目名称:MPFProj10,代码行数:12,代码来源:DragDropHelper.cs
注:本文中的STGMEDIUM类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论