Results 1 to 8 of 8

Thread: command line arguments

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2008
    Posts
    6

    command line arguments

    Hello,
    My application has modified the registry in order to associate itself with certain extensions. If the application isn't running and I open a file associated with it, it works like charm.
    The problem is that when the application is already running, the sub main(used to receive the command line arguments) gets never called and therefore i don't receive the parameters required to treat the given file. My application is just broth to the foreground.

    Please HELP!

  2. #2
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    Re: command line arguments

    That is the default behaviour with PocketPC - only one copy of the application can run.

    Should your application already be running?
    Pete Vickers
    MVP - Device Application Development
    http://www.gui-innovations.com http://mobileworld.appamundi.com/blogs/

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2008
    Posts
    6

    Re: command line arguments

    It is supposed to be a single instance application, associated with certain extensions at all time.(witch is not the case when the application is running)
    Think of the behavior of winamp, wmp or other multimedia applications: a file is playing, you browse your computer/pocketpc, and you doubleclick on a media file. The application is instantly brought to the foreground and the file is played(or enqueued, depending on your winamp configuration).
    However, to achieve this I need to be able to receive command line arguments at run-time.(the arguments defined in the registry for the given extensions).

  4. #4

    Thread Starter
    New Member
    Join Date
    Apr 2008
    Posts
    6

    Re: command line arguments

    If this could help, I need to find a compact framework event that works as the StartupNextInstance event.

  5. #5
    New Member
    Join Date
    Apr 2008
    Posts
    2

    Re: command line arguments

    I have searched the web to its limits... how the hell do you grab the commandline arguments? What kind of a project are you creating to do this successfully, .Net Compact 1.0 or without the (1.0) tag? A snippet of argument code would be greatly appreciated.

  6. #6
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    Re: command line arguments

    Hi,
    just use Sub Main in a module, and do something like...
    Code:
        Sub Main(ByVal args As String())
            For Each arg As String In args
                Console.WriteLine(arg)
            Next arg
        End Sub
    Pete
    Pete Vickers
    MVP - Device Application Development
    http://www.gui-innovations.com http://mobileworld.appamundi.com/blogs/

  7. #7
    New Member
    Join Date
    Apr 2008
    Posts
    2

    Re: command line arguments

    Quote Originally Posted by petevick
    Hi,
    just use Sub Main in a module, and do something like...
    Code:
        Sub Main(ByVal args As String())
            For Each arg As String In args
                Console.WriteLine(arg)
            Next arg
        End Sub
    Pete
    Thanks so much Pete, finally worked. Can't do it on a form looks like... per this article. http://www.tech-archive.net/Archive/...4-03/0637.html

    Thanks again!!!

  8. #8

    Thread Starter
    New Member
    Join Date
    Apr 2008
    Posts
    6

    Re: command line arguments

    Ok, i've found a way to do this(accept args at runtime):
    I've created a launcher application(console) witch i associate with the extensions that i need and initiated a socket between it and the main app. Upon a double click of a file the launcher is started, receives the path of the file i need to handle. It then tries to send the args via tcp. If the main app isn't working, i just open it with from the launcher with the given args.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width