long MsHtmHstInterop.IDropTarget.DragOver( [In] int grfKeyState, [In] POINTL pt, [In, Out] ref uint pdwEffect) { uint effect = 0; if (m_pPreDropTarget != null) { m_pPreDropTarget.DragOver(grfKeyState, pt, ref effect); } pdwEffect = effect | 1; return(S_OK); }
long MsHtmHstInterop.IDropTarget.DragEnter( [In] System.Runtime.InteropServices.ComTypes.IDataObject pDataObject, [In] int grfKeyState, [In] POINTL pt, [In, Out] ref uint pdwEffect ) { uint effect = 0; if (m_pPreDropTarget != null) { m_pPreDropTarget.DragEnter(pDataObject, grfKeyState, pt, ref effect); } pdwEffect = effect | 1; return(S_OK); }
public static POINTL operator -(POINTL p1, POINTL p2) { POINTL ret = new POINTL(); ret.x = p1.x - p2.x; ret.y = p1.y - p2.y; return ret; }
long MsHtmHstInterop.IDropTarget.Drop( [In] System.Runtime.InteropServices.ComTypes.IDataObject pDataObject, [In] int grfKeyState, [In] POINTL pt, [In, Out] ref uint pdwEffect ) { System.Runtime.InteropServices.ComTypes.IEnumFORMATETC pEnum = (System.Runtime.InteropServices.ComTypes.IEnumFORMATETC)pDataObject.EnumFormatEtc(DATADIR.DATADIR_GET); pEnum.Reset(); FORMATETC[] etcs = new FORMATETC[1]; int[] pceltFetched = new int[1]; while (pEnum.Next(1, etcs, pceltFetched) == 0) { if (etcs[0].cfFormat == 15) { STGMEDIUM data; pDataObject.GetData(ref etcs[0], out data); if (data.tymed == TYMED.TYMED_HGLOBAL) { string[] items = null; IntPtr pData = GlobalLock(data.unionmember); try { int size = (int)GlobalSize(data.unionmember); int len = 0; unsafe { Int32 *pOffset = (Int32 *)pData; Int16 *pFileNames = (Int16 *)((Int32)pData + (*pOffset)); size -= *pOffset; while (true) { if (len >= size || (pFileNames[len] == 0 && pFileNames[len + 1] == 0)) { break; } len += 2; } String s = Marshal.PtrToStringUni((IntPtr)pFileNames, len); items = s.Split(new char[] { (char)0 }); } } finally { GlobalUnlock(data.unionmember); } StringBuilder files = new StringBuilder(); foreach (string file in items) { if (System.IO.File.Exists(file)) { if (files.Length > 0) { files.Append('\0'); } files.Append(file); } } if (files.Length > 0) { _window.IWindow.OnDropFiles.Call(files.ToString()); return(S_OK); } } } else if (etcs[0].cfFormat == 13) { STGMEDIUM data; pDataObject.GetData(ref etcs[0], out data); String text = null; if (data.tymed == TYMED.TYMED_HGLOBAL) { IntPtr hData = GlobalLock(data.unionmember); try { int size = (int)GlobalSize(data.unionmember); text = Marshal.PtrToStringUni(hData); } finally { GlobalUnlock(data.unionmember); } } Hashtable data_json = null; try { data_json = Utility.ParseJson(text) as Hashtable; } catch { data_json = null; } if (data_json != null && data_json.ContainsKey("__Type") && data_json.ContainsKey("__Data")) { string drop_type = data_json["__Type"].ToString(); string drop_data = data_json["__Data"].ToString(); _window.IWindow.OnDrop.CallAll(drop_type, drop_data); return(S_OK); } } } if (m_pPreDropTarget != null) { m_pPreDropTarget.Drop(pDataObject, grfKeyState, pt, ref pdwEffect); } return(S_OK); }
public void Drop(Microsoft.VisualStudio.OLE.Interop.IDataObject pDataObj, uint grfKeyState, POINTL pt, ref uint pdwEffect) { //throw new NotImplementedException(); }
public void DragOver(uint grfKeyState, POINTL pt, ref uint pdwEffect) { //throw new NotImplementedException(); }
public bool OnDrop(IntPtr pDataObject, uint grfKeyState, POINTL pt, IntPtr pdwEffect) { ltf.RunJavaScript("$(\"#div1\").text('动作:Drop')"); return(true); }
public bool OnDragOver(uint grfKeyState, POINTL pt, IntPtr pdwEffect) { ltf.RunJavaScript("$(\"#div1\").text('动作:DragOver')"); return(true); }
public HRESULT Drop(IDataObject *pDataObj, [NativeTypeName("DWORD")] uint grfKeyState, POINTL pt, [NativeTypeName("DWORD *")] uint *pdwEffect) { return(((delegate * unmanaged <IDropTarget *, IDataObject *, uint, POINTL, uint *, int>)(lpVtbl[6]))((IDropTarget *)Unsafe.AsPointer(ref this), pDataObj, grfKeyState, pt, pdwEffect)); }