473,466 Members | 1,369 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Windows Service function calling from an application.

3 New Member
Hi guys,

I want to call a function of an application (Windowsapplication1.exe)from a windows service context menu (System Tray).


1. Through System.Reflection i try for but i get an error TargetInvocationException is unhandle.


private void RequestProfileData(object serder,System.Eventargs e)
{System.Reflection.Assembly a = System.Reflection.Assembly.Load(@"C:\WinServe\Wind owsApplication1\bin\Debug\WindowsApplication1.exe" );
Type mytype = a.GetType("WindowsApplication1.metadata");
System.Reflection.MethodInfo mymethod = mytype.GetMethod("metadata");
Object obj = Activator.CreateInstance(mytype);
mymethod.Invoke(sobj, null);

}


2. i try through P/Invoke. Get the TargetInvocationException was not handle.


this is inside a class.
[DllImport("CureControlCommLib.dll", EntryPoint = "RequestProfileData")]
static extern bool RequestProfileData();

CureControlApplication.CureControlCommLib.CAPADevi ceComm DeviceCom = new CAPADeviceComm();
DeviceCom.RequestProfileData();



Thanking You a lot Please send a mail to me regarding any information you get.
Aug 23 '06 #1
2 2560
jiten
3 New Member
Hi,

I want a quick reply for this TargetInvocationException handling.
Aug 23 '06 #2
jiten
3 New Member
hi,

This is possible to invoke a function from an dll at runtime.Then how?
Aug 23 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Stephan Lux | last post by:
Hi all, I have developed a windows service with Visual Basic .NET which starts a file conversion tool via the commandline. The tool open the files (z.B. Word, Excel, Acrobat...) and prints them...
1
by: jdm | last post by:
Using the function below, I'm importing configuration parameters, from an xml file, into a Windows service. This code works as expected in a regular Windows application, but when used in a Windows...
2
by: Chris | last post by:
Hi, Currently, I have a console application written in C# and an unmanaged legacy DLL written in VC++ 6.0. In the DLL's previous application, when an event occurs in the DLL, a windows message...
9
by: SP | last post by:
Hi All, I wrote a windows service which is supposed to stop after specified amount of time. I am calling OnStop() after specified time. OnStop() methods executed but I dont see the service...
7
by: Ahmed Perlom | last post by:
Hi all, I am trying to start a windows application that has a GUI from a Windows service written in .NET 2.0. I have been searching on this for few days now with no avail. When using the...
2
by: Hakan Örnek | last post by:
Hi , I want to parameter passing to my windows sevice. I call service commands like this ; '------------------------------------------------------------ Dim sc As ServiceController sc = New...
28
by: | last post by:
I have a multi threaded windows form application that runs great after calling Application.Run(). Application.Run is required for a COM component I a using in the app (required for message loop). ...
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?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: Susan Harris | last post by:
I have a Windows (NT) service developed in .NET 3.5 (VS2008). I want this service to log messages to a WinForms application that will display it's progress to the user. It has to run under Vista,...
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
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,...
1
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.