|
-
Apr 7th, 2008, 07:51 PM
#1
Thread Starter
New Member
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!
-
Apr 9th, 2008, 01:52 AM
#2
Frenzied Member
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?
-
Apr 9th, 2008, 03:24 AM
#3
Thread Starter
New Member
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).
-
Apr 10th, 2008, 07:05 PM
#4
Thread Starter
New Member
Re: command line arguments
If this could help, I need to find a compact framework event that works as the StartupNextInstance event.
-
Apr 12th, 2008, 10:25 PM
#5
New Member
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.
-
Apr 13th, 2008, 01:57 AM
#6
Frenzied Member
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
-
Apr 13th, 2008, 02:13 AM
#7
New Member
Re: command line arguments
 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!!!
-
Apr 13th, 2008, 09:02 AM
#8
Thread Starter
New Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|