473,394 Members | 1,869 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,394 software developers and data experts.

Launch a program and a function by File Type

Hi,

I have created a program which opens up ".pcfs" files, a kind of text
file unique to my program. I want to be able to click on these files
and have the program launch AND load the contents of the clicked file.
I have been able to do the first half. I can click on a .pcfs file and
the program comes up. But how do I make the program "see" the clicked
file and load it?

I'm not even sure what this action is called, and so I haven't found
any resources on an internet search. Anybody know how to do this?

Thanks in advance.

Jan 25 '06 #1
2 1089
bidalah wrote:
Hi,

I have created a program which opens up ".pcfs" files, a kind of text
file unique to my program. I want to be able to click on these files
and have the program launch AND load the contents of the clicked file.
I have been able to do the first half. I can click on a .pcfs file and
the program comes up. But how do I make the program "see" the clicked
file and load it?

I'm not even sure what this action is called, and so I haven't found
any resources on an internet search. Anybody know how to do this?

Thanks in advance.


You need to look at the command line arguments when your program
launches. The filename and path will be passed in that way. So you
just have a function to open the file when it sees a file. Do a search
on "vb.net commandline arguments" and you'll get a lot of examples.
Jan 25 '06 #2
"bidalah" <bi*****@yahoo.com> schrieb:
I have created a program which opens up ".pcfs" files, a kind of text
file unique to my program. I want to be able to click on these files
and have the program launch AND load the contents of the clicked file.
I have been able to do the first half. I can click on a .pcfs file and
the program comes up. But how do I make the program "see" the clicked
file and load it?


Add the code below to an empty ".vb" file, then select 'Sub Main' as startup
object in the project properties. 'OpenFile' can be replaced with your
logic used to open and display the file's content.

\\\
Public Module Program
Public Function Main(ByVal Args() As String) As Integer
If Args.Length > 0 Then
OpenFile(Args(0))
End If
End Function
End Module
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jan 25 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Danny De Koster | last post by:
Hi all, I'm really a newbie. How can I trap (read in my program) the parameters which where giving at the launch of the my program? thanks for any tips Danny
17
by: SK | last post by:
I am calling an exe thru' href, but when it executes, I get the message if I want to open the file(exe file). Is there any way I can suppress this from appearing and open the program? Thank...
4
by: Caroline | last post by:
I'd like to launch an executable file from a web page. Basically, the user enters seven parameters and then clicks a button to generate a graph. The input is written to a file and then read by...
8
by: Dutchy | last post by:
Dear reader, In an attempt to obtain the path to the quick-launch-folder in order to create a shortcut to my application-updates during installation , I thought to: 1- check if quick launch...
3
by: Michel H | last post by:
Hello everyone, While it seems simple to me, I just want to have a URL in my windows application that people can click and then launch the URL in the default browser. Same thing with a mailto:...
1
by: john conwell | last post by:
I've got a process engine written in .Net. the user writes a data file and saves it as file type ".xyz". I have a file assiciation set up in the database that when a .xyz file is invoked (double...
2
by: Peter Ignarson | last post by:
Hi there - I am writing a paint program (I am following a learning tutorial, there is no point to writing a paint program) and I want to extend it so that I can copy the contents of my drawing and...
1
by: sylsau | last post by:
Hello, I wrote a JAVA program which uses the JAVA API JDOM 1.0 (of this site www.jdom.org) I put the archive jdom.jar in the directory /usr/share/java/jdom.jar and I added this path in the...
3
by: LordHog | last post by:
Hello, How would I go about finding the default handler, let's say a text file (*.txt), then launch the default handler with the file as an argument? I had found how to launch an external...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.