从内存流复制时显示 Windows 文件复制对话框? [英] Display Windows File Copy Dialog when copying from a Memorystream?

查看:22
本文介绍了从内存流复制时显示 Windows 文件复制对话框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序将从 MemoryStream 将文件写入磁盘.我不想创建自己的进度对话框,而是喜欢使用现有的 Windows 功能,例如SHFileOperation Win32 API,显示带有动画和进度条的标准文件复制对话框.但是,此特定 API 要求指定源文件的路径.是否可以通过此 API 以某种方式使用 MemoryStream 或我可以使用其他 API?

My application will be writing files to the disk from a MemoryStream. Instead of creating my own progress dialogs, I would love to use existing windows functionality e.g. SHFileOperation Win32 API that shows the standard file copy dialog box with animation and progress bar. However, this particular API requires that a path to the source file be specified. Is it possible to somehow use a MemoryStream with this API or is there another API that I can use?

推荐答案

您可以使用 Shell Progress Dialogs 用于此;此 API 仅公开对话框,允许您使用它来显示您自己的应用程序中任何类型操作的进度.

You can use Shell Progress Dialogs for this; this API exposes the dialog only, allowing you to use it to show the progress of any type of operation in your own application.

我不久前为此编写了一个托管包装器,您可能会发现它很有用:使用Windows 窗体应用程序中的 Shell 进度对话框

I wrote a managed wrapper for this a while ago, which you may find useful: Using Shell Progress Dialogs in Windows Forms Applications

这篇关于从内存流复制时显示 Windows 文件复制对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆