Using "Open With"

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Daniel Miller

    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
  • WRH

    #2
    Re: Using "Open With"

    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 Miller@discussi ons.microsoft.c om> wrote in message
    news:D9A6105C-1C73-4F78-A768-AF56B028814C@mi crosoft.com...

    [color=blue]
    >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[/color]


    Comment

    • Daniel Miller

      #3
      Re: Using &quot;Open With&quot;

      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:
      [color=blue]
      > 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 Miller@discussi ons.microsoft.c om> wrote in message
      > news:D9A6105C-1C73-4F78-A768-AF56B028814C@mi crosoft.com...
      >
      >[color=green]
      > >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[/color]
      >
      >
      >[/color]

      Comment

      • WRH

        #4
        Re: Using &quot;Open With&quot;

        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" <DanielMiller@d iscussions.micr osoft.com> wrote in message
        news:8A966E16-5A77-494C-9AD1-47CF3D852E49@mi crosoft.com...[color=blue]
        > 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:
        >[color=green]
        >> 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 Miller@discussi ons.microsoft.c om> wrote in
        >> message
        >> news:D9A6105C-1C73-4F78-A768-AF56B028814C@mi crosoft.com...
        >>
        >>[color=darkred]
        >> >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[/color]
        >>
        >>
        >>[/color][/color]


        Comment

        • Daniel Miller

          #5
          Re: Using &quot;Open With&quot;

          Okay, thanks. :)

          "WRH" wrote:
          [color=blue]
          > 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" <DanielMiller@d iscussions.micr osoft.com> wrote in message
          > news:8A966E16-5A77-494C-9AD1-47CF3D852E49@mi crosoft.com...[color=green]
          > > 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:
          > >[color=darkred]
          > >> 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 Miller@discussi ons.microsoft.c om> wrote in
          > >> message
          > >> news:D9A6105C-1C73-4F78-A768-AF56B028814C@mi crosoft.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
          > >>
          > >>
          > >>[/color][/color]
          >
          >
          >[/color]

          Comment

          Working...