如何使用多个应用程序实例实现进度栏? [英] How to implement a Progress Bar with multiple instances of application ?

查看:152
本文介绍了如何使用多个应用程序实例实现进度栏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我向注册表添加了一个注册表项,以便当我右键单击JPG文件时,看到一个新的转换"选项,该选项实际上在运行我的应用程序.
我想实现一个进度条,以查看所有JPG的转换进度.
问题是当我选择N个JPG并在它们上应用变换"时,我的应用程序运行N次(每次选择一个JPG).这样,在我的应用程序中,我只能知道一个转换进度.
您能否建议一种解决方案来实现进度栏? (也许是创建一些临时文件,还是类似的东西??)

谢谢!

Hi,

I added a key to the Registry such that when I right click on a JPG file I see a new "Transform" option that actually runs my application.
I would like to implement a Progress Bar to see the progress of the Transformations of all JPGs.
The problem is when I select N JPGs and apply "Transform" on them, my application runs N times (each time with one selected JPG). This way, in my application I can be aware of a single Transformation progress only.
Could you suggest a workaround to implement the Progress Bar ? (maybe to create some temporary file, or something like that...?)

Thanks !

推荐答案

为什么不在命令行上传递所有选定文件,并为每个文件启动一个转换线程(使用线程池).然后,您可以为每个文件都有一个进度条,或者只有一个以某种方式显示合并进度的文件.我想您已经编写了一个Shell扩展,它将菜单项添加到Explorer上下文菜单中.
Why don''t you pass all of the selected files on the command line and start a transform thread for each one (use a thread pool). Then, you could have a progressbar for each file, or just one that somehow shows the combined progress. I imagine you''ve already written a shell extension that adds a menu item to the Explorer context menu.


我不认为您不能发送n个参数.您只能使用%传递在注册表中提到的参数编号.
%l实际上代表您在调用进程时通过的路径.

可能的解决方法可能是,我认为您需要以一种方式来装备您的应用程序,以便当一个进程已经加载时,它将检测其他任何进程是否将要运行.您可能会检测是否已经在运行一个应用程序,并以每次打开另一个实例的方式对应用程序进行设备配置,它将路径放置在某个共享位置并销毁自身.我认为大多数同时打开多个文件的应用程序都使用这种技术.

:cool:
I dont think you cant send n nos of arguments. You can pass only the nos of arguments that you mention in the registry using %.
%l actually represents the path which you pass while calling the process.

The possible way out might be, I think you need to device your application in such a way that it will detect if the any other process is going to run when one process is already loaded. You might detect if there is already one appliction is running, and device your application in such a manner that evertime the other instance opens, it just puts the path in some shared location and destroy itself. I think most of the application which opens multiple files all at a time uses this technique.

:cool:


我确实添加了shell扩展.我把"my_application.exe%1"放在那里.
这样,每次仅传递一个文件.
如何在命令行中传递所有选定的文件?
谢谢!
I did added the shell extension. I put there "my_application.exe %1".
This way only one file passed each time.
How can I pass all of the selected files on the command line ?
Thanks !


这篇关于如何使用多个应用程序实例实现进度栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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