打开相关文件(不是Regedit问题)

时间:2014-03-26 19:26:34

标签: vb.net

我成功地将文件与我的应用程序相关联(Extension * .dvk); 我还设法使用OpenFileDialog1打开它们,如下所示:

OpenFileDialog1.Filter = "DVK Files (*.dvk)|*.dvk"

挑战是当我点击相关文件时,它会打开我的应用程序,但它是空的; 问题是:如何打开在其中打开的单击文件的应用程序?

我找到了这段代码,但没有用:

Dim fi As IO.FileInfo ' used to test for file properties
If My.Application.CommandLineArgs.Count > 0 Then
fi = New IO.FileInfo(My.Application.CommandLineArgs(0))
If fi.Exists Then
Select Case fi.Extension.ToLower
Case ".fred"
' do something with fred
Case ".wilma"
' do something with wilma
Case Else
' do something else
End Select
End If
End If

我的注册表修改如下:

Root: HKCR; Subkey: ".dvk"; ValueType: string; ValueName: ""; ValueData: "Quotation System"; Flags: uninsdeletevalue 
Root: HKCR; Subkey: "Quotation System"; ValueType: string; ValueName: ""; ValueData: "Quotation System"; Flags: uninsdeletekey 
Root: HKCR; Subkey: "Quotation System\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\Quotation System.EXE,0" 
Root: HKCR; Subkey: "Quotation System\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\Quotation System.EXE"" ""%1""" 

0 个答案:

没有答案