Exemple #1
0
        public DataTransferManagerHelper(IntPtr handle)
        {
            //TODO: Add a check for failure here. This will fail for versions of Windows
            //below Windows 10
            IActivationFactory factory = WindowsRuntimeMarshal.GetActivationFactory(typeof(DataTransferManager));

            interop = (IDataTransferManagerInterOp)factory;

            windowHandle = handle;
            DataTransferManager dtm = null;
            Guid riid = new Guid(DataTransferManagerId);

            interop.GetForWindow(windowHandle, riid, out dtm);

            this.DataTransferManager = dtm;
        }
Exemple #2
0
        public DataTransferManagerHelper(IntPtr handle)
        {
            //TODO: Add a check for failure here. This will fail for versions of Windows below Windows 10
            IActivationFactory activationFactory = WindowsRuntimeMarshal.GetActivationFactory(typeof(DataTransferManager));

            // ReSharper disable once SuspiciousTypeConversion.Global
            _dataTransferManagerInterOp = (IDataTransferManagerInterOp)activationFactory;

            _windowHandle = handle;
            var riid    = new Guid(DataTransferManagerId);
            var hresult = _dataTransferManagerInterOp.GetForWindow(_windowHandle, riid, out var dataTransferManager);

            if (hresult.Failed())
            {
                Log.Warn().WriteLine("HResult for GetForWindow: {0}", hresult);
            }
            DataTransferManager = dataTransferManager;
        }