since long time ago

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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!
 
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 said:
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.

FileAssociation
<URL:http://www.mentalis.org/soft/class.qpx?id=5>

\\\
Public Module Program
Public Sub Main(ByVal Args() As String)
If Args.Length > 0 Then

' 'Args' is a string array that contains the command line
' parameters' values.
OpenTheFile(Args(0))
End If
End Sub
End Module
///
 
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
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/>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top