473,385 Members | 1,780 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

pass parameter from windows service to windows application

Hi,

I have 2 applications running, one Windows application project and the other
windows services project.
I want to call my Windows application in my windows services.
I want to run them as seperate process.
If my windows application starts running,only if it completes fully,
then my windows services should continue its execution.

My main process is Windows service.
I want to pass Windows services,MakeZip function parameters to my Windows
Application
MakeZip(string zipname,string[] files)
I want to pass this function parameters to my Windows application.
How can I do this?Only then I know my windows application will run
internally as seperate process
without disturbing windows services.I think we have to use command line
arguments,
but I dont know how to use it.

Here is my code for Windows service and windows application.
Please help me
1. how to create process ie. how to run windows application as seperate
process
inside windows services code.I want windows service to run as seperate
process and
Windows application to run as seperate process.
2. how to pass parameters from windows services project to windows
application project.
//My Code starts here:
Windows Services:

MakeZip(string zipname,string[] files)
{
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents=false;
proc.StartInfo.FileName="c:\\programfiles\\visuals tudioprojects\\WindowsAppZip.exe";
proc.Start();
MessageBox.Show("Zipped Done");
}
WindowsAppZip:

using Xceed.Compression;

using Xceed.FileSystem;

using Xceed.Zip;

private void button2_Click(object sender, System.EventArgs e)
{
// In my windows services zipname and files have got values.
//I want to call them here in this application from Windows service
MakeZip(string zipname,string[] files) // calling MakeZipFile Function Here
}
Xceed.Zip.Licenser.LicenseKey = "ZINxx-xxxxx-xxxxx-xxxx";

public int MakeZip(string zipFileName, string[] filesToComp)
{
int retVal = 0;
try
{
ZipArchive zip = new ZipArchive( new DiskFile( zipFileName ) );
try
{
zip.BeginUpdate();
foreach( string file in filesToComp )
{
DiskFile fileToZip = new DiskFile( file );
fileToZip.CopyTo( zip, true );
++retVal;
}
}
finally
{
zip.EndUpdate();
}
}

catch(Exception exec)
{
throw new ZipException(exec.Message);
}
finally
{
}
return retVal;
}
}

}
Dec 31 '07 #1
1 4816
you can do this in several ways

but the easiest in my opinion would be to use the proces class
http://www.freevbcode.com/ShowCode.asp?ID=5879 the parameters can be
retrieved from the command http://www.devx.com/dotnet/Article/10115 note
the options of the process class
HTH

Michel


"vishruth" <vi******@discussions.microsoft.comschreef in bericht
news:28**********************************@microsof t.com...
Hi,

I have 2 applications running, one Windows application project and the
other
windows services project.
I want to call my Windows application in my windows services.
I want to run them as seperate process.
If my windows application starts running,only if it completes fully,
then my windows services should continue its execution.

My main process is Windows service.
I want to pass Windows services,MakeZip function parameters to my Windows
Application
MakeZip(string zipname,string[] files)
I want to pass this function parameters to my Windows application.
How can I do this?Only then I know my windows application will run
internally as seperate process
without disturbing windows services.I think we have to use command line
arguments,
but I dont know how to use it.

Here is my code for Windows service and windows application.
Please help me
1. how to create process ie. how to run windows application as seperate
process
inside windows services code.I want windows service to run as seperate
process and
Windows application to run as seperate process.
2. how to pass parameters from windows services project to windows
application project.
//My Code starts here:
Windows Services:

MakeZip(string zipname,string[] files)
{
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents=false;
proc.StartInfo.FileName="c:\\programfiles\\visuals tudioprojects\\WindowsAppZip.exe";
proc.Start();
MessageBox.Show("Zipped Done");
}
WindowsAppZip:

using Xceed.Compression;

using Xceed.FileSystem;

using Xceed.Zip;

private void button2_Click(object sender, System.EventArgs e)
{
// In my windows services zipname and files have got values.
//I want to call them here in this application from Windows service
MakeZip(string zipname,string[] files) // calling MakeZipFile Function
Here
}
Xceed.Zip.Licenser.LicenseKey = "ZINxx-xxxxx-xxxxx-xxxx";

public int MakeZip(string zipFileName, string[] filesToComp)
{
int retVal = 0;
try
{
ZipArchive zip = new ZipArchive( new DiskFile( zipFileName ) );
try
{
zip.BeginUpdate();
foreach( string file in filesToComp )
{
DiskFile fileToZip = new DiskFile( file );
fileToZip.CopyTo( zip, true );
++retVal;
}
}
finally
{
zip.EndUpdate();
}
}

catch(Exception exec)
{
throw new ZipException(exec.Message);
}
finally
{
}
return retVal;
}
}

}


Jan 1 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: elora_c | last post by:
I'm making a call to a webservice from my ASP.NET page. The web application has anonymous access turned off and Integrated Windows auth turned on. The web.config has <identity impersonate=true>. ...
2
by: SBh. via DotNetMonster.com | last post by:
I already created a windows service that receive parameter in Sub GetValue () and I can registered and started service successfully. But unfortunately, I don't know how to write program to call...
3
by: ssg31415926 | last post by:
I administer a Server 2003/XP network. A developer has come to me with a proposal to put in a web service-based application. The workstations will be XP and the servers 2003 but he can't use...
6
by: placek | last post by:
Hi all. I would like to create two web services: - The first one - ImportData - should take as an input parameter a XML document and return an integer saying if passed XML document was valid...
2
by: ojinfo | last post by:
hi i am currently working on a web service which is supposed to take a xmldocument as input parameter, and then returns another xmldocument. the service is added to the web references in my...
5
by: David++ | last post by:
Hi folks, I would be interested to hear peoples views on whether or not 'pass by reference' is allowed when using a Web Service method. The thing that troubles me about pass-by-reference into...
2
by: =?Utf-8?B?dmlzaHJ1dGg=?= | last post by:
Hi, I have 2 applications running, one Windows application project and the other windows services project. I want to call my Windows application in my windows services. I want to run them as...
1
by: =?Utf-8?B?RGFtaXIgRGV6ZWxqaW4=?= | last post by:
Hi. I have to implement an Java Axis2 web service client in .NET WCF as well a web service to witch a Java Axis2 client will connect. I would like to provide user identification using...
12
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.