473,473 Members | 1,875 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Using "Open With"

I have developed a simple text editing program using Windows Forms. I want
to be able to right-click on a text file, choose "Open With" and select my
program from the list to open the file, but I don't know how to get my
program to "accept" a file in such a way.

Is it using the command line? If so, what arguements are passed? Should I
deal with them after capturing the Load event, or is there a different event?
Am I not even close?

Thank you for your time.

-Daniel
Nov 17 '05 #1
4 2325
WRH
Hello

You can access the command line parameters at the main entry point,eg...
static void Main(string [] args)

{

if(args.GetLength(0) >0)
{
string filearg = args[0]

etc

"Daniel Miller" <Daniel Mi****@discussions.microsoft.com> wrote in message
news:D9**********************************@microsof t.com...

I have developed a simple text editing program using Windows Forms. I want
to be able to right-click on a text file, choose "Open With" and select my
program from the list to open the file, but I don't know how to get my
program to "accept" a file in such a way.

Is it using the command line? If so, what arguements are passed? Should
I
deal with them after capturing the Load event, or is there a different
event?
Am I not even close?

Thank you for your time.

-Daniel

Nov 17 '05 #2
Thank you for the response.

I know how to access the command line arguments, but I don't know which
arguments (if any) are sent . Additionally, I am not sure after which event
to act on them.

"WRH" wrote:
Hello

You can access the command line parameters at the main entry point,eg...
static void Main(string [] args)

{

if(args.GetLength(0) >0)
{
string filearg = args[0]

etc

"Daniel Miller" <Daniel Mi****@discussions.microsoft.com> wrote in message
news:D9**********************************@microsof t.com...

I have developed a simple text editing program using Windows Forms. I want
to be able to right-click on a text file, choose "Open With" and select my
program from the list to open the file, but I don't know how to get my
program to "accept" a file in such a way.

Is it using the command line? If so, what arguements are passed? Should
I
deal with them after capturing the Load event, or is there a different
event?
Am I not even close?

Thank you for your time.

-Daniel


Nov 17 '05 #3
WRH
The path of the file selected in Windows Explorer's "Open With" is
passed as the first argument, ie arg[0]

In my case I act upon it just after Form InitializeComponent()
"Daniel Miller" <Da**********@discussions.microsoft.com> wrote in message
news:8A**********************************@microsof t.com...
Thank you for the response.

I know how to access the command line arguments, but I don't know which
arguments (if any) are sent . Additionally, I am not sure after which
event
to act on them.

"WRH" wrote:
Hello

You can access the command line parameters at the main entry point,eg...
static void Main(string [] args)

{

if(args.GetLength(0) >0)
{
string filearg = args[0]

etc

"Daniel Miller" <Daniel Mi****@discussions.microsoft.com> wrote in
message
news:D9**********************************@microsof t.com...

>I have developed a simple text editing program using Windows Forms. I
>want
> to be able to right-click on a text file, choose "Open With" and select
> my
> program from the list to open the file, but I don't know how to get my
> program to "accept" a file in such a way.
>
> Is it using the command line? If so, what arguements are passed?
> Should
> I
> deal with them after capturing the Load event, or is there a different
> event?
> Am I not even close?
>
> Thank you for your time.
>
> -Daniel


Nov 17 '05 #4
Okay, thanks. :)

"WRH" wrote:
The path of the file selected in Windows Explorer's "Open With" is
passed as the first argument, ie arg[0]

In my case I act upon it just after Form InitializeComponent()
"Daniel Miller" <Da**********@discussions.microsoft.com> wrote in message
news:8A**********************************@microsof t.com...
Thank you for the response.

I know how to access the command line arguments, but I don't know which
arguments (if any) are sent . Additionally, I am not sure after which
event
to act on them.

"WRH" wrote:
Hello

You can access the command line parameters at the main entry point,eg...
static void Main(string [] args)

{

if(args.GetLength(0) >0)
{
string filearg = args[0]

etc

"Daniel Miller" <Daniel Mi****@discussions.microsoft.com> wrote in
message
news:D9**********************************@microsof t.com...
>I have developed a simple text editing program using Windows Forms. I
>want
> to be able to right-click on a text file, choose "Open With" and select
> my
> program from the list to open the file, but I don't know how to get my
> program to "accept" a file in such a way.
>
> Is it using the command line? If so, what arguements are passed?
> Should
> I
> deal with them after capturing the Load event, or is there a different
> event?
> Am I not even close?
>
> Thank you for your time.
>
> -Daniel


Nov 17 '05 #5

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

Similar topics

10
by: Berthold Hoellmann | last post by:
Hello, When I use ./configure --with-thread --with-fpectl --with-signal-module \ --with-pymalloc --enable-shared --with-cxx=g++ make test on 2.3.3 I get
14
by: john.burton.email | last post by:
I've done some extensive searching and can't seem to find an answer to this - Is it correct to using "using" with templates, for example: using std::vector; Or do I need to specify the type...
9
by: mahurshi | last post by:
i have a quick question i am putting a debug flag in my program (i really dont need this feature, but i figured it might be useful when i get into trouble) so i want to check if argv is the...
9
by: Paul Brownjohn | last post by:
Hello I am new both to this group and to C# programming having spent the last 15 years or so writing C and VB. You will forgive I hope if I am asking the totally obvious but it is a question...
7
by: Hareth | last post by:
When VS2003 is installed : I can open Form1.cs w/ windows "open with" contextmenu, then it opens the file w/ notepad & it works fine but after installing VS2005, "open with" doesnt...
2
by: OutdoorGuy | last post by:
Greetings, I have a "newbie" question in relation to opening files from C#. I have a Windows form where I allow the user to type in a file extension in a text box (e.g., "xls"). I then take...
1
by: kbarrios | last post by:
Hi, I am working with VBScript and I put a "window.open" inside a "form action post" due that I am handing a "checkbox" on it, but the "window.open" doesn't work: <FORM...
0
by: Ofelia | last post by:
Hi, I'm new to this forum and to Perl language but I would like to ask for your help. I'm working in Linux and the files I need to process are in the format “file.gz”. I created a script which...
5
by: Stefano Tonello | last post by:
Hi all, I need to call windows' "open with" dialog from my C# windows form application. After the user selects application, control must return to me (I have to launch directly the process). I...
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,...
1
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...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.