Re: Open file and program



After modifying the registry so that your program is the default, you will
then need to:

1) Modify your startup code to read Command$, and parse out the filename of
what is to be loaded. The Command$ is sent by Windows to start your app, and
will include the full path of the filename.

If you want to allow multiple instances of your program, or if you want to
end it automatically as soon as it's done what it has to do with the
filename, then you're pretty well done; just end the program after doing the
printing or whatever. If not, then:

2) Modify the startup code to check for a previous instance. If you find
one, you'll need to transfer the filename you receive from the Command$ to
the other instance (typically by populating a text box, the change event of
which will cause the other program to load the file), switch to the first
instance, and end the second instance.

--
Regards,

Rick Raisley

"Ralph" <nt_consulting64@xxxxxxxxx> wrote in message
news:O2Cs9SFXIHA.5208@xxxxxxxxxxxxxxxxxxxxxxx

"Ivar" <Ivar.Ekstromer000@xxxxxxxxxxxx> wrote in message
news:dO3lj.2657$L73.1491@xxxxxxxxxxxxxxxxxxxxxxx
Hi all.

The senario is:
I have a file on the C drive named "C:\MyFile.mff" (My Funny File). It's
a
little text file containing:
1,2,3,4,5
6,7,8,9,10
11,12,13,14,15
I have a VB6 form with 1 command button, the code is:

Private Sub Command1_Click()
Dim FileNum As Long
Dim TheStr As String
FileNum = FreeFile
Open "C:\MyFile.mff" For Input As FileNum
Do Until EOF(FileNum)
Line Input #FileNum, TheStr
Me.Print TheStr
Loop
Close FileNum
End Sub

All simple stuff, run the complied exe, click the button and stuff is
printed on the form.

Now, what I would like to do is :-)
Associate the .mff extention with the little app.(as in - register the
.mmf
file extention to my little app in winders using a VB6 exe.
Double click "C:\MyFile.mff" in windows explorer and winders will open
my
little app and run the command1 code.

How to do?

Any pointers please.


To set up File Associations you can use the command-line Assoc through a
shell, etc. or you can directly modify the Registery.

Here is an interesting article.

http://www.vbaccelerator.com/home/VB/Code/Libraries/Shell_Projects/Registering_File_Associations/article.asp

-ralph




.