473,834 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
+ 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 2358
WRH
Hello

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

{

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

etc

"Daniel Miller" <Daniel Mi****@discussi ons.microsoft.c om> wrote in message
news:D9******** *************** ***********@mic rosoft.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.GetLeng th(0) >0)
{
string filearg = args[0]

etc

"Daniel Miller" <Daniel Mi****@discussi ons.microsoft.c om> wrote in message
news:D9******** *************** ***********@mic rosoft.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 InitializeCompo nent()
"Daniel Miller" <Da**********@d iscussions.micr osoft.com> wrote in message
news:8A******** *************** ***********@mic rosoft.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.GetLeng th(0) >0)
{
string filearg = args[0]

etc

"Daniel Miller" <Daniel Mi****@discussi ons.microsoft.c om> wrote in
message
news:D9******** *************** ***********@mic rosoft.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 InitializeCompo nent()
"Daniel Miller" <Da**********@d iscussions.micr osoft.com> wrote in message
news:8A******** *************** ***********@mic rosoft.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.GetLeng th(0) >0)
{
string filearg = args[0]

etc

"Daniel Miller" <Daniel Mi****@discussi ons.microsoft.c om> wrote in
message
news:D9******** *************** ***********@mic rosoft.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
3093
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
2182
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 too: using std::vector<int>; Both seem to "work" on the compiler I have and I can't find any documentation saying which is correct, or are both correct?
9
5934
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 letter "d" this is what i have so far if (argv) { write_read_input_file(filename); }
9
17778
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 that I cannot find an answer to in the doc: Is there an equivalent in C# to the "With Me" syntax in VB; specifically some means of getting a down-down that enumerates the objects available on a
7
1653
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 function correctly. If I try to open with notepad, it forces an open to VS2005
2
4428
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 that extension and use that as my filter criteria for the File Open dialog. Once the user selects a file with that extension (from the File Open dialog), I simply want to open that file (whether it is an .xls file, .txt file, etc.). I am...
1
5241
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 ACTION="baz_add_action.asp" METHOD="post"> ...here go the Window.open script <INPUT NAME="add<%=p_prod_id%>" TYPE="checkbox" value="ON">
0
2676
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 should decompress, open and then delete nearly 400 files. To do so I use "open FILEPT, "zcat $filename|"". In the beginning the script works fine, but after about 300 files processed I get an error on Open function: “proc: Could not open file...
5
6229
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 found this solution: http://www.codeproject.com/KB/shell/openwith.aspx but it's not good for me since it will execute the process directly.
0
10793
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10509
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10219
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9331
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7757
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6954
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5793
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4427
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 we have to send another system
3
3081
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.