Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Opening saved file with .xxx extension


Message #1 by "Bejoy Mathew (MICO/DAN)" <Bejoy.Mathew@i...> on Thu, 15 Nov 2001 05:07:34 +0100
I believe that when your app is activated by double-clicking an associated
file, that the path & filename of the file that was double-clicked is
accessible from the Command() function.  So, if you were to include code in
your startup method that did something like:

' WARNING--AIR CODE!
Dim strOpenFile as String

strOpenFile = Command()

If Len(strOpenFile) > 0 Then
   If Dir(strOpenFile) <> "" Then
      ' Pass the value of strOpenFile to whatever code is 
      ' called by your app's File->Open menu item.
   End If
End If

you may be able to get where you want to be...

(BTW, by "startup method" I mean code that runs when you're app first
starts--if your startup object is a form, then maybe the Open method of that
form--if it's a sub, then that sub, etc.).

HTH,

-Roy

P.S. Using DAO does not preclude using ADO--it's quite possible to use
both--you just have to be careful about fully qualifying object references.

Roy Pardee
Programmer/Analyst
SWFPAC Lockheed Martin IT
Extension 8487

-----Original Message-----
From: Bejoy Mathew (MICO/DAN) [mailto:Bejoy.Mathew@i...]
Sent: Thursday, November 15, 2001 8:10 PM
To: professional vb
Subject: [pro_vb] RE:RE: Opening saved file with .xxx extension


X-Message-Number: 18

I did exactly what u have said ..Identified it as a filetype in the folder
options...
But then it works as long as I open the file through the application using
the open command...
This is because the file is actually a text file and has to be read by
splitting thru the contents and assigning it to specific text boxes and list
boxes ; the code of which has been put in the open statement...
How do I make it do the same when I double click the file??

I am using DAO ;  so ADO option is ruled out





X-ListManager-Id: 120238
Date: Thu, 15 Nov 2001 07:29:27 -0800
From: "Pardee, Roy E" <roy.e.pardee@l...>
Subject: RE: Opening saved file with .xxx extension

I'm not completely sure I understand the question, but maybe you could
register your application as the one for opening files with an ".xxx"
extension?  You can do this manually in windows explorer by going to Tools
-> Folder Options -> File Types.  There are no doubt programmatic ways for
doing this also--maybe someone else can advise you on that.  Note that if
you do this you'll have to include code in your startup return that looks at
the Command function to see which file your program was called to open.

One other option that may work is to save your data as xml, which would open
up (read-only I believe) in internet explorer when double-clicked.  The
easiest way I know of to do that is to put the data in a disconnected ADO
recordset & then calling the .Save method with the adPersistXML option.

HTH,

-Roy

Roy Pardee
Programmer/Analyst
SWFPAC Lockheed Martin IT
Extension 8487



  Return to Index