2014-12-03 38 views
0

我的工作是與文件類型符「.gif」相關的,每當我在PC上的任何地方打開.gif注意:圖像,它會得到路徑的程序路徑的文件,並將其設置爲Picturebox.imageLocation獲得一個打開的文件的

我一直在谷歌搜索的答案,我似乎無法找到正確的詞找到它。我看過一些視頻,他們使用預設位置,所以這對我沒有多大幫助。

回答

0

您是否已經設置好「.gif」文件關聯設置?如果不是看到Associating file extensions with a program

一旦這部分做,你應該在註冊表中是這樣的:

HKEY_CURRENT_USER \ Software \ Classes下\ yourcorpname.yourappname.v1 \殼\開放\命令」 ,空,@「C:\路徑\到\ APP.EXE \」%1 \「」

當文件被打開%1被替換的文件的路徑你只需要進行Main方法有參數:

Sub Main(ByVal cmdArgs() As String) 
    MsgBox("The Main procedure is starting the application.") 
    Dim returnValue As Integer = 0 
    ' See if there are any arguments. 
    If cmdArgs.Length > 0 Then 
     Dim pathToGifFile As String = cmdArgs(0) 
     ' Now you have the path to the picture to add to the PictureBox 
    End If 
    ' Insert call to appropriate starting place in your code. 
    MsgBox("The application is terminating.") 
End Sub 
相關問題