Click to See Complete Forum and Search --> : command line arguments
otherside
Apr 7th, 2008, 07:51 PM
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!
petevick
Apr 9th, 2008, 01:52 AM
That is the default behaviour with PocketPC - only one copy of the application can run.
Should your application already be running?
otherside
Apr 9th, 2008, 03:24 AM
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).
otherside
Apr 10th, 2008, 07:05 PM
If this could help, I need to find a compact framework event that works as the StartupNextInstance event.
JZ SmartMort
Apr 12th, 2008, 10:25 PM
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.
petevick
Apr 13th, 2008, 01:57 AM
Hi,
just use Sub Main in a module, and do something like...
Sub Main(ByVal args As String())
For Each arg As String In args
Console.WriteLine(arg)
Next arg
End Sub
Pete
JZ SmartMort
Apr 13th, 2008, 02:13 AM
Hi,
just use Sub Main in a module, and do something like...
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/DotNet/microsoft.public.dotnet.framework.compactframework/2004-03/0637.html
Thanks again!!!
otherside
Apr 13th, 2008, 09:02 AM
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.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.