文件关联,从Windows资源管理器中同时打开多个文件. [英] File association, Open multiple files at the same time, from windows explorer.

查看:227
本文介绍了文件关联,从Windows资源管理器中同时打开多个文件.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

(我是一位经验丰富的程序员,请不要告诉我一些简单的技巧,例如转换或singleinstance)

我有一个难题.为了解释这个问题,我举了两个例子来说明它是如何工作的,以及如何以不同的方式工作.

--------------------------------------------------- --------------------------

示例1.将几个文件拖到我的.exe文件中"

然后,

命令类似于:New String("file1.extension""file2.extension""file3.extension")

wich可以打开而不会出现这样的问题:

 

对于FilesToOpen中的每个文件 Return(replace(file,``,",","))'这将list _

的所有文件彼此正确地返回到处理中. !!!没有什么问题.!!! 下一个


--------------------------------------------------- -

示例2.文件关联槽注册表(选择了多个文件->打开..)

由于某种原因,命令以这种方式变为:

(盯着.exe实例),使用命令:"file1.extension"

(从另一个实例开始),使用命令:"file2.extension"

(从第三个实例开始),使用命令:"file3.extension"

示例1的问题是,仅当您将几个文件拖到我的应用程序的.exe文件中时,此方法才有效.但是,当您通过注册表将其关联时,选择几个文件,然后单击打开".每次启动.exe多次 单独命令.我不想要的.我想要它像上面,但通过寄存器关联的方式.我认为这是一个与寄存器有关的问题,而不是vb.net问题.因为启动了第二个实例.

-----------------------------------------------

我已经用自己的代码重新创建了一个单实例应用程序,以将命令发送到先前启动的实例,然后最后退出.但这不是问题.而不以任何方式引起它.所以不要理会.

解决方案

尝试下面的代码

将FilesToOpen()设置为字符串= split(command,"""))
将FileList变暗为新列表(字符串)
对于FilesToOpen中的每个文件

FileList.Add(replace(File,``'',``,'')))'此正确的文件名list_的所有文件

正确地彼此冲撞.
下一个
返回FileList 



hello,

( i am an experienced programmer, dont tell me about simple tips, like converting, or singleinstance )

i have an difficult problem. to explain the problem i have made 2 examples to make clear how it does and does not work in different ways.

-------------------------------------------------------------------------

example 1. 'dragging a couple of files to my .exe file'

the command is then like : New String("file1.extension" "file2.extension" "file3.extension")

wich can open without problems like this :

dim FilesToOpen() as string = split(command, """ """)

For each File in FilesToOpen Return (replace(file, """", "")) 'This returns all the files of the list_

'correctly after each other to pocess. !!!without problems.!!! Next


------------------------------------------------

example 2. file association trough registry ( selected multiple files -> open with.. )

for some reason the command becomes in this way :

(staring an .exe instance) with command : "file1.extension"

(starting anotother instance) with command : "file2.extension"

(starting third instance) with command : "file3.extension"

the problem with example 1 is, that this only works if you drag a couple of files into my .exe file of my application. But when you associate it trough the registry and select a couple of files and click 'open'. it launches the .exe multiple times for each command seperatly. which i do not want. i want it like the above, but trough the register-associated way. i think it is an register related problemen rather than a vb.net problem. because of starting second instances.

-------------------------------------------

EDIT :

i have already recreated an singleinstance application by own code to send commands to the previously started instance and then exit on the end. but this is NOT the problem. and not causing it in any way. so ignore this.

解决方案

Try code below

dim FilesToOpen() as string = split(command, """ """)
dim FileList as New List(Of String)
For each File in FilesToOpen

	FileList.Add(replace(File, """", ""))  'This correct filename all the files of the list_

	'correctly after each other to pocess.
Next
Return FileList



这篇关于文件关联,从Windows资源管理器中同时打开多个文件.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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