msvisual.com Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

pass parameter from windows service to windows application i

 
Post new topic   Reply to topic    msvisual.com Forum Index -> VB WinAPI
Author Message
vishruth



Joined: 31 Dec 2007
Posts: 1

PostPosted: Mon Dec 31, 2007 4:14 pm    Post subject: pass parameter from windows service to windows application i Reply with quote

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\\visualstudioprojects\\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;
}
}

}

Archived from group: microsoft>public>vb>winapi
Back to top
View user's profile Send private message
Bob Butler



Joined: 04 Oct 2007
Posts: 1081

PostPosted: Mon Dec 31, 2007 5:36 pm    Post subject: Re: pass parameter from windows service to windows applicati Reply with quote

"vishruth" wrote in message @microsoft.com...
> Hi,


Form the initial description I thought this was going to get really involved
since you're talking about a very awkward thing in what, IMO anyway, sounds
like a very bad design.

> MakeZip(string zipname,string[] files)
> {
> System.Diagnostics.Process proc = new System.Diagnostics.Process();

But posting C# code in a VB "classic" newsgroup makes it easy...


--
You need to ask in a newsgroup with "dotnet" in the name. This group is for
VB 6.0 and earlier and does not include VB.Net or VB 200x or any version of
C#

Back to top
View user's profile Send private message
Display posts from previous:   
Related Topics:
windows service i need to add my exe to windows service If you Know thanls

resend: windows fax service i'm able to send out fax using xp fax service. but how can i extract send status from Fax like what we see in fax consol ? Thanks!

Windows Service Properties Hello NG, I have a slide problem: Background: We install a part of our software as a windows services. (on NT 4, and 2000) Now we have released an update and want the update to replace the old exe file. But we don't know where the customers have installed

The Windows NT Service ActiveX DLL The Windows NT Service ActiveX DLL allows developers to quickly and easily write Windows services in Visual Basic. You can implement a ActiveX events to receive Service Manager Start, Stop, Pause and Continue events. You can also easily add performance co

I would like to write a Windows Service app I would like to write a Windows Service app that will be notified when an interactive user logs on/off the local computer. Thanks in advance
Post new topic   Reply to topic    msvisual.com Forum Index -> VB WinAPI All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group