Click here to Skip to main content
15,921,793 members
Home / Discussions / C#
   

C#

 
AnswerRe: byte array to string and back encoding problem Pin
Guffa18-Mar-07 8:18
Guffa18-Mar-07 8:18 
GeneralRe: byte array to string and back encoding problem Pin
zuidgeest18-Mar-07 10:26
zuidgeest18-Mar-07 10:26 
Questionrandom sql Pin
ujupanmester18-Mar-07 6:10
ujupanmester18-Mar-07 6:10 
AnswerRe: random sql Pin
Mudsoad18-Mar-07 7:07
Mudsoad18-Mar-07 7:07 
GeneralRe: random sql Pin
ujupanmester18-Mar-07 15:02
ujupanmester18-Mar-07 15:02 
Questionopening file with my program Pin
dsl/fahk18-Mar-07 3:59
dsl/fahk18-Mar-07 3:59 
AnswerRe: opening file with my program Pin
Stefan Troschuetz18-Mar-07 4:36
Stefan Troschuetz18-Mar-07 4:36 
AnswerRe: opening file with my program Pin
Wayne Phipps18-Mar-07 5:01
Wayne Phipps18-Mar-07 5:01 
Firstly, it would have been better to keep this to the original thread where others could benifit from knowing what advice you've already been given.

Secondly, your application would need to process command line arguments.

As an example, if you had a text file named "myfile.foo" in the same directory as you appliation, you would be able to pass the filename to your application at the command prompt by typing "myApp.exe myfile.foo" or alternatively drag & drop the Foo file onto your exe.

This would start your application which could then perform any function you like.

It would obviously make sense that you application check the file extension ".foo" was correct before doing anything.

For more information on command line arguments, look here: http://msdn2.microsoft.com/en-us/library/acy3edy3.aspx

You could rig up a test application? If you create a new console application, you can paste the following code to replace the Main method:
public static void Main(string[] args)
{
    if ( args.Length > 0 )
    {
        if ( args[0].ToLower().EndsWith(".foo") )
            //do something with foo file
            Console.WriteLine( "Openning Foofile named {0}", args[0] );
    }

    Console.WriteLine("Press any key to continue...");
    Console.ReadKey();
}

If you then build the application and create a text file named "test.foo" in the same folder, you should be able to drag & drop the Foo file onto your app.

This should run the app which simply displays the full path to the Foo file.

Once you've got this working, you've just got to create some method to actually do something with the file.

I guess it depends what you want it to do?

Lastly, you would have to associate an file extension with your application so that Windows knows what to do when somone tries to open this type of file. This is normally the job of an installer like InstallShield however, you can make this association manually.

If you double-click the Foo file, windows will normally complain that it cant open the file, then..
1) Simply select "Select a program from the list" and click "OK"
2) Tick the box which reads "Always use the selected program to open this kind of file"
3) The click the "browse" button where you can search for your application.

Foo files would always be opened by your application.


Hope this helps




Regards

Wayne Phipps
____________

Time is the greatest teacher... unfortunately, it kills all of its students
View my Blog

QuestionRe: opening file with my program Pin
dsl/fahk19-Mar-07 15:04
dsl/fahk19-Mar-07 15:04 
AnswerRe: opening file with my program Pin
Wayne Phipps20-Mar-07 10:27
Wayne Phipps20-Mar-07 10:27 
QuestionMicrosoft Office Translations Pin
mm31018-Mar-07 3:55
mm31018-Mar-07 3:55 
AnswerRe: Microsoft Office Translations Pin
Ed.Poore19-Mar-07 13:03
Ed.Poore19-Mar-07 13:03 
QuestionProblem receiving data through serial port Pin
naffilk18-Mar-07 2:46
naffilk18-Mar-07 2:46 
AnswerRe: Problem receiving data through serial port Pin
rbirkelbach19-Mar-07 5:03
rbirkelbach19-Mar-07 5:03 
Questionc# word xp textbox Pin
spinis18-Mar-07 0:00
spinis18-Mar-07 0:00 
AnswerRe: c# word xp textbox Pin
Thomas Stockwell19-Mar-07 8:26
professionalThomas Stockwell19-Mar-07 8:26 
QuestionBioinformatic algorithms in C# Pin
bufugus17-Mar-07 23:50
bufugus17-Mar-07 23:50 
AnswerRe: Bioinformatic algorithms in C# Pin
b0ksah19-Mar-07 0:28
b0ksah19-Mar-07 0:28 
QuestionGeneral info passer? Pin
gvanto17-Mar-07 22:39
gvanto17-Mar-07 22:39 
AnswerRe: General info passer? Pin
Stefan Troschuetz17-Mar-07 22:58
Stefan Troschuetz17-Mar-07 22:58 
GeneralRe: General info passer? Pin
gvanto17-Mar-07 23:15
gvanto17-Mar-07 23:15 
GeneralRe: General info passer? Pin
Stefan Troschuetz17-Mar-07 23:39
Stefan Troschuetz17-Mar-07 23:39 
QuestionQuestion about office outlook Pin
ThetaClear17-Mar-07 21:56
ThetaClear17-Mar-07 21:56 
AnswerRe: Question about office outlook Pin
ThetaClear18-Mar-07 5:56
ThetaClear18-Mar-07 5:56 
QuestionHow to get textbox (rich or plain) to remain scrolled to the bottom? Pin
sherifffruitfly17-Mar-07 21:06
sherifffruitfly17-Mar-07 21:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.