I have a file assosiation, and i want my users to be able to click the file and it will open up my app with the contents of that file loaded.
Cheers // ILMV
Printable View
I have a file assosiation, and i want my users to be able to click the file and it will open up my app with the contents of that file loaded.
Cheers // ILMV
If the file is already associated with your application Windows will open your app and pass the file name and path to it on the command line. So you just have to call the code you're already using to open a known file and pass the Command$ string.VB Code:
Private Sub Form_Load() Dim sFileName As String sFileName = Command$ If Len(sFileName) Then 'we have some info from the command line OpenFile sFileName 'The above assumes that you already have a Sub/Function called OpenFile 'that will open the passed file name. End If End Sub
Im getting an error, i can load up my file when the program is running, but it doesnt load from the file in windows?
i get the error "52: bad file name or number"
:S
Oh yeah, Windows pass the filename enclosed by quotation marks, just remove them first.VB Code:
Private Sub Form_Load() Dim sFileName As String sFileName = Command$ If Len(sFileName) Then 'we have some info from the command line [b] sFileName = Replace(sFileName, """", "") [/b] OpenFile sFileName 'The above assumes that you already have a Sub/Function called OpenFile 'that will open the passed file name. End If End Sub
WOOO!!! cheers mate
ILMV :D