473,583 Members | 4,428 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

pass parameter from windows service to windows application interna

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,MakeZi p 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.Diagnost ics.Process proc = new System.Diagnost ics.Process();
proc.EnableRais ingEvents=false ;
proc.StartInfo. FileName="c:\\p rogramfiles\\vi sualstudioproje cts\\WindowsApp Zip.exe";
proc.Start();
MessageBox.Show ("Zipped Done");
}
WindowsAppZip:

using Xceed.Compressi on;

using Xceed.FileSyste m;

using Xceed.Zip;

private void button2_Click(o bject sender, System.EventArg s 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.Licen ser.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.CopyT o( zip, true );
++retVal;
}
}
finally
{
zip.EndUpdate() ;
}
}

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

}
Dec 31 '07 #1
2 4475
Why not have the service perform the zip operation?

Regardless, you will need to use remoting for this. You will have to
have the windows application contact the server over a remoting channel
(using Remoting, or Windows Communications Foundation), and then store a
reference to an object derived from MarshalByRefObj ect that the windows
application passes to the server (or if using WCF, you would pass a callback
interface which would be called by the server).

Then, you would make calls in the service to the client through the
reference passed to it.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"vishruth" <vi******@discu ssions.microsof t.comwrote in message
news:86******** *************** ***********@mic rosoft.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,MakeZi p 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.Diagnost ics.Process proc = new System.Diagnost ics.Process();
proc.EnableRais ingEvents=false ;
proc.StartInfo. FileName="c:\\p rogramfiles\\vi sualstudioproje cts\\WindowsApp Zip.exe";
proc.Start();
MessageBox.Show ("Zipped Done");
}
WindowsAppZip:

using Xceed.Compressi on;

using Xceed.FileSyste m;

using Xceed.Zip;

private void button2_Click(o bject sender, System.EventArg s 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.Licen ser.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.CopyT o( zip, true );
++retVal;
}
}
finally
{
zip.EndUpdate() ;
}
}

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

}


Dec 31 '07 #2
Can u please provide me the snippet of code (related to my task) to perform
this task.
I have absolutely no idea about remoting or WCF .
Thank u for ur help.
Vishruth

"Nicholas Paldino [.NET/C# MVP]" wrote:
Why not have the service perform the zip operation?

Regardless, you will need to use remoting for this. You will have to
have the windows application contact the server over a remoting channel
(using Remoting, or Windows Communications Foundation), and then store a
reference to an object derived from MarshalByRefObj ect that the windows
application passes to the server (or if using WCF, you would pass a callback
interface which would be called by the server).

Then, you would make calls in the service to the client through the
reference passed to it.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"vishruth" <vi******@discu ssions.microsof t.comwrote in message
news:86******** *************** ***********@mic rosoft.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,MakeZi p 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.Diagnost ics.Process proc = new System.Diagnost ics.Process();
proc.EnableRais ingEvents=false ;
proc.StartInfo. FileName="c:\\p rogramfiles\\vi sualstudioproje cts\\WindowsApp Zip.exe";
proc.Start();
MessageBox.Show ("Zipped Done");
}
WindowsAppZip:

using Xceed.Compressi on;

using Xceed.FileSyste m;

using Xceed.Zip;

private void button2_Click(o bject sender, System.EventArg s 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.Licen ser.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.CopyT o( zip, true );
++retVal;
}
}
finally
{
zip.EndUpdate() ;
}
}

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

}


Jan 1 '08 #3

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

Similar topics

1
2195
by: jaya | last post by:
Hi, I am using asp.net to pass parameters from .aspx page to my Microsoft reporting service. My .aspx page has checkbox. If it is checked it the chekbox should pass value =0 to my report <INPUT id="ReviewedBy" style="WIDTH: 16px; HEIGHT: 20px" type="checkbox" name="ReviewedBy" value = 0> if the check box is unchecked it should pass value...
2
2999
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 this windows service. Anyone can help me and give me some example code, please .... My windows service source code are as below : - - - - - - - -...
3
9757
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 Integrated Windows authentication with the logged-on account because some of the workstations are shared and have a "department" account (with minimum...
6
9005
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 and was succesfully processed. - The second one - ExportData - should take as an input parameter an integer an return a XML document. I would like...
2
1312
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 windows application, and the call is executed. problem is that the input arguments gets value nothing in the web service. currently the code works as...
5
7809
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 a WebService is that essentially we are passing an address of an object which resides on the 'local machine' i.e. a local machine object address....
1
4840
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 seperate process. If my windows application starts running,only if it completes fully, then my windows services should continue its execution. My...
1
3118
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 basicHTTP user/pass authentication. Later I'll move both ends to SSL (https). I already implemented the Java Axis2 end: - Axis2 Client axis2.xml:
12
11048
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. Here is a newbie mistake that I found myself doing (as a newbie), and that even a master programmer, the guru of this forum, Jon Skeet, missed!...
0
7894
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7825
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8179
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7933
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8191
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5700
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5372
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3841
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1431
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.