473,386 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

since long time ago

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
3 1349
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: cyril | last post by:
I saw that is a recurrent message but i couln't succed in founding the solution ... I'm developping under Linux Does anyone have a code snippet that permit to get in a simple long var the...
2
by: Rene Ren | last post by:
I can using Environment.TickCount property to get the time elapsed since the system started. but this property using A 32-bit signed integer type, so it's can't count the time more than 24.9 days....
77
by: Peter Olcott | last post by:
http://www.tommti-systems.de/go.html?http://www.tommti-systems.de/main-Dateien/reviews/languages/benchmarks.html The above link shows that C# is 450% slower on something as simple as a nested loop....
11
by: Ryan Liu | last post by:
In Visual Studio 2003, when i debug a C# program, I found: 300L * 10000000l -1294967296 int 210L * 10000000L 2100000000 int How come? a long type can not handle 300L * 10000000l, the result...
102
by: hug | last post by:
www.webmaster, was suggested that this ng could be a better place.] I've updated my test server to handle if-modified-since. I've noticed that the (old copies I run of) IE and Netscape seem...
5
by: Summu82 | last post by:
HI I have to convert a time in the format i have year month day hour min and seconds I need to convert this into time in seconds since 1 jan 1970 i.e the
11
by: jyck91 | last post by:
// Base Conversion // Aim: This program is to convert an inputted number // from base M into base N. Display the converted // number in base N. #include <stdio.h> #include <stdlib.h>...
3
by: timhoagland | last post by:
Hi, I have a C++ data acquisition program, running under Linux. The basic stucture is: Setup devices Acquire data for x seconds. Cleanup. The problem is that I don't have a way to...
23
by: nsa.usa | last post by:
Hi, I used to use a function in other languages (TP or asm don't remember) where I could get number of clockticks since 1980. Is there a similar function in C? I don't seem to find it. I need...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.