I have 2 programs that I used clickonce with so it created a .application vs an exe.
I was wanting to pass parameters from one program to another. Ever since I did this the command I use to grab that parameter from the first program does not work. It gives an error. Basically I need to have the first program pass a variable to the newly open application. How do I do this since it is an .application file
If I kept everything an .exe it works great so the code seems to be ok. I am just thinking that you cannot pass parameters when it is an .application. If this is true i then need to know how to go about so.

Pass parameter from one program to another
nileshdr1
that wouldnt be a good solution at all I'm afraid :-) The reason is because you are trying to write to disk which has a perf hit, ok not so much when its a small thing like this but what if the file hasnt fully been created by the time you run the other app what about if the user decides to tamper with the file giving the arguments incorrectly to the other application What happens if you are not allowed to write to disk Errors!
you can pass parameters to another program but it depends how you want it to. Do you mean your application will run another application if so then you can use the System.Diagnostics.ProcessStartInfo class to start the process and use arguments to give it parameters. Example:
System.Diagnostics.ProcessStartInfo otherApp = new System.Diagnostics.ProcessStartInfo("file.exe");
otherApp.Arguments = "args here";
Process.Start(otherApp);
in the Arguments property, insert there the arguments you want to give your other application. It will then recieve it and if its your own application you can either modify the main() method of it to accept the string[] arguments/parameters:
static void Main(string[] args)
{
if (args.Length > 0)
{
Console.Write("args length: " + args.Length.ToString());
Console.Write("\n\n");
foreach (string curArg in args)
{
Console.WriteLine(curArg);
}
}
else
{
Console.WriteLine("No args supplied");
}
}
as an example. Or you can use the Environment.GetCommandLineArgs(); which returns a string[] array of arguments given to the application.
re-reading, you are referring to a .application file - what file is this (sounds familiar) how did you create it what errors do you get when passing args to it
Steve Wang 2006
I will take a look at it.
I'll let everyone know.
Thanks everyone and Happy Holidays to all of you.
Lo0ney
How about calling a web service and retrieve parameter info
progames25
Hugo Soares
S. Brennan
I tried the file situation and it works but I do not like the security of it. Meaning if the user knew where the file was and made changes it would give them certain rights. Also some user rights pcs had problems.
Now for the passing arguement it is a great idea and I really want to do this, but you cannot do this with an .application. This is the file extention given to a program that is created using clickonce technology. This publish the program to an IIS server and eliminates the need to manually deploy on each pc and also ensures each user has the latest update of the program. Great technology.
I thought about passing parameters through the http:\\ line but then the user would have that in there history and could get smart and change the information and get different rights, etc.
Soulia
.Net 2.0+ presents a special Channel under Remoting technology, speacially for this purpose. The Ipc Channel (System.Runtime.Remoting.Channels.Ipc.IpcChannel is specially desinged for Inter process communication. Means it provides and easy and flexible way for an application to communicate with other applications running seperately but sharing data/information in form of objects........ It provides you much more freedom than otherways do because its specially designed for the same purpose.
Here is some small help and an article:
http://msdn2.microsoft.com/en-us/library/system.runtime.remoting.channels.ipc.ipcchannel.aspx
http://www.codeguru.com/csharp/csharp/cs_syntax/remoting/article.php/c9251/
I hope you'll find it really handy and usefull.
Best of luck ;)
Merry Christmas,
Rizwan
THNQDigital
im not sure if you have looked at this:
http://msdn2.microsoft.com/en-us/library/ms172242(VS.80).aspx
im guessing you may have done as you stated the http:// query string in your last sentence! :-)
kennm
I looked at your links a little and it seems like I have to create a dll basically that each program has included. Am I correct in understand that
If so I really didn't want to have to do that.