473,394 Members | 1,327 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,394 software developers and data experts.

Trigger an event on another .NET App

Hi

I have two .NET applications that run together on the same local PC.

I have a situation, that when I click a button on the first application, I
need to trigger an event for the second Application.

What is the simplest way to implement that ?
Nov 21 '05 #1
6 1993
Hi,
What is the simplest way to implement that ?


Send WM_USER message to main window of second application, and catch it in
it.

The simplest way I can imagine. 8=]

Roman
Nov 21 '05 #2
"Dragon" <no@spam.please> wrote in message
Hi,
What is the simplest way to implement that ?


Send WM_USER message to main window of second application, and catch it in
it.

The simplest way I can imagine. 8=]


A lot of people do it that way including me, so I've not actually learned
the 'proper' way to do it :)

If one application calls the other, make the second an ActiveX .EXE and call
that (This is how Microsoft Office products interact).

I'm led to believe by one of my co-workers that the ActiveX EXE can call
each other in .NET without using COM. In other words - one will not have to
be dependant on the stub of the other - but I haven't looked into it. Please
let me know if you find a modern solution to this problem!

BTW: Will "Remoting" solve your problem?

--
Mike Wilson*
Evolved Software Studios Ltd
www.evolvedsoftwarestudios.com

*Ask me about getting YOU a VIDEO of your software being tested in Windows
Vista for ONLY $25
Nov 21 '05 #3
What's WM_USER message?. can you elaborate ?
"Dragon" <no@spam.please> wrote in message
news:O1**************@TK2MSFTNGP14.phx.gbl...
Hi,
What is the simplest way to implement that ?


Send WM_USER message to main window of second application, and catch it in
it.

The simplest way I can imagine. 8=]

Roman

Nov 21 '05 #4
"romy" <ro******@hotpop.com> schrieb
What's WM_USER message?. can you elaborate ?

http://msdn.microsoft.com/library/en...ue#app_defined
http://msdn.microsoft.com/library/en...es/wm_user.asp

Armin

Nov 21 '05 #5
In addition to Armin:

http://msdn.microsoft.com/library/en...suserinterface
/windowing/messagesandmessagequeues/messagesandmessagequeuesreference/me
ssagesandmessagequeuesfunctions/sendmessage.asp

http://msdn.microsoft.com/library/en...suserinterface
/windowing/messagesandmessagequeues/messagesandmessagequeuesreference/me
ssagesandmessagequeuesfunctions/postmessage.asp

http://msdn.microsoft.com/library/en...suserinterface
/windowing/messagesandmessagequeues/messagesandmessagequeuesreference/me
ssagesandmessagequeuesfunctions/sendmessagetimeout.asp

A bit of code:

~
Friend Declare Auto Function SendMessage Lib "user32.dll" ( _
ByVal hwnd As IntPtr, _
ByVal Msg As Int32, _
ByVal wParam As Int32, _
ByVal lParam As Int32 _
) As Int32

Private Const WM_USER As Int32 = &H400

....

' First app
SendMessage(SecondAppProcess.MainWindowHandle, WM_USER, 1, 0)

....

' Second app
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
If m.Msg = WM_USER AndAlso m.WParam.ToInt32 = 1 Then
' Do whatever you want
End If
End Sub
~

HTH

Roman

"romy" <ro******@hotpop.com> сообщил/сообщила в новостях следующее:
news:uo**************@TK2MSFTNGP12.phx.gbl...
What's WM_USER message?. can you elaborate ?
"Dragon" <no@spam.please> wrote in message
news:O1**************@TK2MSFTNGP14.phx.gbl...
Hi,
What is the simplest way to implement that ?


Send WM_USER message to main window of second application, and catch it
in it.

The simplest way I can imagine. 8=]

Roman



Nov 21 '05 #6
Hi,

You can use CreateEvent / SetEvent API functions ..
Give name to this event and you can track it by his name from both of your
applications.

I'm using this API functions in my interprocess communication library:
http://www.habjansoftware.com/ipc_library.aspx

Regards,
Josip Habjan
http://www.habjansoftware.com

"romy" <ro******@hotpop.com> wrote in message
news:ue**************@TK2MSFTNGP14.phx.gbl...
Hi

I have two .NET applications that run together on the same local PC.

I have a situation, that when I click a button on the first application,
I need to trigger an event for the second Application.

What is the simplest way to implement that ?

Nov 21 '05 #7

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

Similar topics

3
by: Luklrc | last post by:
Hi. I have a problem I hope someone can help me with. I have a database of events. Each event has a date and a duration (days). What I need to do is to be able to display search for events...
4
by: Peter Lin | last post by:
Dear all; I need to monitor a xml file so that I can update my data in hashtable, but the problem is it will trigger more than one event for a lastwrite action(I trigger this action by add...
3
by: dana lees | last post by:
Hi, I'm writing a C# asp.net web application. I have a frameset in which the upper frame contains a "print" button and the lower frame contains content of a different domain. Since i cannot...
1
by: Zyrthofar | last post by:
Hi I have three textboxes indicating the individual RGB values of a color. When the user leaves a textbox (Leave event), I check the validity of that number and saves the three values to a set of...
3
by: rmorvay | last post by:
I allow users to click a datagrid row and it spawns another browser page to allow edits to the data in that row. Once they update the data, it is committed to the database and the form is closed. ...
1
by: Rob R. Ainscough | last post by:
During the course of separating my Business code from UI code, I'm trying to have nested class instances be able to RaiseEvent on my Form1 code. I'm not have much success, it works with the...
2
by: Tom_F | last post by:
To comp.databases.ms-access -- I would like to trigger an event when I close a form -- but ONLY when the data in the "RecordSource" table has been updated. I tried using the AfterUpdate event,...
6
by: wugon.net | last post by:
Hi , Anyone know how to monitor db2 trigger activity ? We suffer some trigger issue , and we try to monitor trigger's behavior use event monitor and db2audit, but both tools can not get...
0
by: wugon.net | last post by:
Hi , Anyone know how to monitor db2 trigger activity ? We suffer some trigger issue today and we try to monitor trigger's behavior use event monitor and db2audit, but both tools can not get...
7
by: Wojto | last post by:
Hello! Another day, another problem... :-) I've got something like this: CREATE TABLE A ( pk_A INT CONSTRAINT primarykey_A PRIMARY KEY ); CREATE TABLE B (
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.