By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,510 Members | 1,821 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,510 IT Pros & Developers. It's quick & easy.

since long time ago

P: n/a
I am developing an application which should enable its user to create a file.
Now, my application will be able to open that file to enable the user to edit
it, etc. Since long time ago, i've been trying to do this: go to windows
explorer and double click the file that was created and then.. the
application should magically open and load the file. I've been able to make
the application run when this happens (it's very simple) though i can't load
the file (because i don't know which file is it ). I'm sure that when
this happens, windows will send some kind of arguments or data to the
program. However, i cannot get this information and, thus, cannot open the
file when the user double clicks on it.

Help please!
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Neo
what you are looking for is File Associations.
You need to Associate your application with your file type.

Esp, *.DOC files open in Word, *.VB open in VS.NET, *.XLS open in Excel,
Similary, you need to setup your file type (what ever the extension of your
file is) to your application.
Unfortuantely i haven't done this, but u just need to look into File
Associations.

I've seen a couple of samples on the net related to this.

"Augusto399" <Au********@discussions.microsoft.com> wrote in message
news:00**********************************@microsof t.com...
I am developing an application which should enable its user to create a file. Now, my application will be able to open that file to enable the user to edit it, etc. Since long time ago, i've been trying to do this: go to windows
explorer and double click the file that was created and then.. the
application should magically open and load the file. I've been able to make the application run when this happens (it's very simple) though i can't load the file (because i don't know which file is it ). I'm sure that when
this happens, windows will send some kind of arguments or data to the
program. However, i cannot get this information and, thus, cannot open the
file when the user double clicks on it.

Help please!

Nov 21 '05 #2

P: n/a
Hi,

The file name will passed in as a command line argument. Use
environment.getcommandlineargs to get the filename.

http://msdn.microsoft.com/library/de...eargstopic.asp

Ken
-----------------------

"Augusto399" wrote:
I am developing an application which should enable its user to create a file.
Now, my application will be able to open that file to enable the user to edit
it, etc. Since long time ago, i've been trying to do this: go to windows
explorer and double click the file that was created and then.. the
application should magically open and load the file. I've been able to make
the application run when this happens (it's very simple) though i can't load
the file (because i don't know which file is it ). I'm sure that when
this happens, windows will send some kind of arguments or data to the
program. However, i cannot get this information and, thus, cannot open the
file when the user double clicks on it.

Help please!

Nov 21 '05 #3

P: n/a
You should check for command line parameters sent to you in the Sub Main.

Windows calls the associated application in the following way:

<Application.exe> %1 %2 %3 %4 %5 ....

here %1 etc. will be replaced with the File Names.

for e.g.

OpenFile.exe C:\Bharat\File1.txt c:\Bharat\File2.txt

In Sub Main parse the command line parameters and do what ever you wanna
do to them.

To get the parameters you can use Microsoft.VisualBasic.Command()
Functrion which Returns the argument portion of the command line used to
launch an executable program.

Example

This example uses the Command function to return the command-line
arguments in an object containing an array.
Function GetCommandLineArgs() As String()
' Declare variables.
Dim separators As String = " "
Dim commands As String = Microsoft.VisualBasic.Command()
Dim args() As String = commands.Split(separators.ToCharArray)
Return args
End Function

Augusto399 wrote:
I am developing an application which should enable its user to create a file.
Now, my application will be able to open that file to enable the user to edit
it, etc. Since long time ago, i've been trying to do this: go to windows
explorer and double click the file that was created and then.. the
application should magically open and load the file. I've been able to make
the application run when this happens (it's very simple) though i can't load
the file (because i don't know which file is it ). I'm sure that when
this happens, windows will send some kind of arguments or data to the
program. However, i cannot get this information and, thus, cannot open the
file when the user double clicks on it.

Help please!


--

Best,
_____________
Bharat Sharma

* TEN Technologies.
* Official Web: _www.ten-technologies.com_
<http://www.ten-technologies.comemail/>
Personal Web: _www.bharatsharma.net_ <http://www.bharatsharma.net/>

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.