Quantcast
Channel: Questions in topic: "dllimport"
Viewing all articles
Browse latest Browse all 160

Drag and Drop file in runtime

$
0
0
hey guys. im using this code to register my window for drag and drop event but unity just crashes. if I use null for the second Parameter of RegisterDragAndDrop function it doesn't crash. I added all .dll files in my plugin floder and api is on .NET 2.0. using UnityEngine; using System.Runtime.InteropServices; using System; using System.Windows.Forms; public class Test : MonoBehaviour{ [DllImport("user32.dll")] private static extern System.IntPtr GetActiveWindow(); [DllImport("ole32.dll")] static extern uint RegisterDragDrop(IntPtr hwnd,IDropTarget dropTarget); // Use this for initialization void Start() { IDropTarget dropTarget = new Drop(); RegisterDragDrop(GetActiveWindow(), dropTarget); } class Drop : IDropTarget { public Drop() { } void IDropTarget.OnDragDrop(DragEventArgs e) { throw new NotImplementedException(); } void IDropTarget.OnDragEnter(DragEventArgs e) { throw new NotImplementedException(); } void IDropTarget.OnDragLeave(EventArgs e) { throw new NotImplementedException(); } void IDropTarget.OnDragOver(DragEventArgs e) { throw new NotImplementedException(); } } } any help will be appreciated

Viewing all articles
Browse latest Browse all 160

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>