473,800 Members | 2,518 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WM_CLOSE

Hello,
Does anyone have any code that will catch a WM_CLOSE message (or any
window message) sent to another application?

TIA,
Steve
Nov 20 '05 #1
11 3319
maybe this will help..
http://msdn.microsoft.com/library/de...dproctopic.asp

Imran.

"Steven" <no****@spam.co m> wrote in message
news:ex******** ******@TK2MSFTN GP09.phx.gbl...
Hello,
Does anyone have any code that will catch a WM_CLOSE message (or any
window message) sent to another application?

TIA,
Steve

Nov 20 '05 #2
Thanks, Imran, that's basically the idea, but I need to do it for another
application. Imagine this scenario: my app (app1) is running, another app
(app2) is running. App2 is closed by user interaction and WM_CLOSE is
generated. App1 needs to catch the WM_CLOSE, determine who it is destined
for, and respond accordingly by updating it's app1 application display. Any
ideas?

Steve

"Imran Koradia" <no****@microso ft.com> wrote in message
news:uG******** *****@TK2MSFTNG P11.phx.gbl...
maybe this will help..
http://msdn.microsoft.com/library/de...dproctopic.asp
Imran.

"Steven" <no****@spam.co m> wrote in message
news:ex******** ******@TK2MSFTN GP09.phx.gbl...
Hello,
Does anyone have any code that will catch a WM_CLOSE message (or any
window message) sent to another application?

TIA,
Steve


Nov 20 '05 #3
If I understand correctly, you're trying to catch the WM_CLOSE of another
app (app2) in your app (app1), right? As far as I know, I don't think you
can catch events raised in one application from another application if that
is in fact what you are implying. However, I may be wrong.
Any specific reason why you want to it this way? Maybe there's some other
way to accomplish what you are attempting to do. A little more detail might
help..

Imran.

"Steven" <no****@spam.co m> wrote in message
news:uO******** ******@tk2msftn gp13.phx.gbl...
Thanks, Imran, that's basically the idea, but I need to do it for another
application. Imagine this scenario: my app (app1) is running, another app
(app2) is running. App2 is closed by user interaction and WM_CLOSE is
generated. App1 needs to catch the WM_CLOSE, determine who it is destined
for, and respond accordingly by updating it's app1 application display. Any ideas?

Steve

"Imran Koradia" <no****@microso ft.com> wrote in message
news:uG******** *****@TK2MSFTNG P11.phx.gbl...
maybe this will help..

http://msdn.microsoft.com/library/de...dproctopic.asp

Imran.

"Steven" <no****@spam.co m> wrote in message
news:ex******** ******@TK2MSFTN GP09.phx.gbl...
Hello,
Does anyone have any code that will catch a WM_CLOSE message (or any
window message) sent to another application?

TIA,
Steve



Nov 20 '05 #4
If I understand correctly, you're trying to catch the WM_CLOSE of another
app (app2) in your app (app1), right? As far as I know, I don't think you
can catch events raised in one application from another application if that
is in fact what you are implying. However, I may be wrong.
Any specific reason why you want to it this way? Maybe there's some other
way to accomplish what you are attempting to do. A little more detail might
help..

Imran.

"Steven" <no****@spam.co m> wrote in message
news:uO******** ******@tk2msftn gp13.phx.gbl...
Thanks, Imran, that's basically the idea, but I need to do it for another
application. Imagine this scenario: my app (app1) is running, another app
(app2) is running. App2 is closed by user interaction and WM_CLOSE is
generated. App1 needs to catch the WM_CLOSE, determine who it is destined
for, and respond accordingly by updating it's app1 application display. Any ideas?

Steve

"Imran Koradia" <no****@microso ft.com> wrote in message
news:uG******** *****@TK2MSFTNG P11.phx.gbl...
maybe this will help..

http://msdn.microsoft.com/library/de...dproctopic.asp

Imran.

"Steven" <no****@spam.co m> wrote in message
news:ex******** ******@TK2MSFTN GP09.phx.gbl...
Hello,
Does anyone have any code that will catch a WM_CLOSE message (or any
window message) sent to another application?

TIA,
Steve



Nov 20 '05 #5
Your understanding is correct. I am trying to detect when an
application(app 2) closes so that I may update app1's GUI. I have
applications that run 24/7. I am writing another application(Aut oStart.exe)
that automates some of the day to day chores concerning these 24/7
applications. What I am trying to do is easy if the AutoStart app starts
the 24/7 apps. As long as the AutoStart app is not closed, it can detect
when any app it has started exits. But in practice, AutoStart starts these
apps, say at system boot, and is then closed. A user then logs in later in
the day and starts the AutoStart app. Now, the AutoStart app displays a list
of running processes in a list box that we are interested in. The problem
is, when one of these apps is closed in any manner, AutoStart does not now
know it and therefore cannot update its display in real time. I could set
up a timer and poll the running processes list at specified intervals, but
this seems wasteful and is not real time. I thought that if I could catch
the WM_CLOSE message going to the closing app in AutoStart, it could respond
appropriately. It's not that easy it seems. Any ideas would be helpful.

Thanks

"Imran Koradia" <no****@microso ft.com> wrote in message
news:uZ******** ******@TK2MSFTN GP12.phx.gbl...
If I understand correctly, you're trying to catch the WM_CLOSE of another
app (app2) in your app (app1), right? As far as I know, I don't think you
can catch events raised in one application from another application if that is in fact what you are implying. However, I may be wrong.
Any specific reason why you want to it this way? Maybe there's some other
way to accomplish what you are attempting to do. A little more detail might help..

Imran.

"Steven" <no****@spam.co m> wrote in message
news:uO******** ******@tk2msftn gp13.phx.gbl...
Thanks, Imran, that's basically the idea, but I need to do it for another
application. Imagine this scenario: my app (app1) is running, another app (app2) is running. App2 is closed by user interaction and WM_CLOSE is
generated. App1 needs to catch the WM_CLOSE, determine who it is destined for, and respond accordingly by updating it's app1 application display.

Any
ideas?

Steve

"Imran Koradia" <no****@microso ft.com> wrote in message
news:uG******** *****@TK2MSFTNG P11.phx.gbl...
maybe this will help..

http://msdn.microsoft.com/library/de...dproctopic.asp

Imran.

"Steven" <no****@spam.co m> wrote in message
news:ex******** ******@TK2MSFTN GP09.phx.gbl...
> Hello,
> Does anyone have any code that will catch a WM_CLOSE message (or any > window message) sent to another application?
>
> TIA,
> Steve
>
>



Nov 20 '05 #6
Your understanding is correct. I am trying to detect when an
application(app 2) closes so that I may update app1's GUI. I have
applications that run 24/7. I am writing another application(Aut oStart.exe)
that automates some of the day to day chores concerning these 24/7
applications. What I am trying to do is easy if the AutoStart app starts
the 24/7 apps. As long as the AutoStart app is not closed, it can detect
when any app it has started exits. But in practice, AutoStart starts these
apps, say at system boot, and is then closed. A user then logs in later in
the day and starts the AutoStart app. Now, the AutoStart app displays a list
of running processes in a list box that we are interested in. The problem
is, when one of these apps is closed in any manner, AutoStart does not now
know it and therefore cannot update its display in real time. I could set
up a timer and poll the running processes list at specified intervals, but
this seems wasteful and is not real time. I thought that if I could catch
the WM_CLOSE message going to the closing app in AutoStart, it could respond
appropriately. It's not that easy it seems. Any ideas would be helpful.

Thanks

"Imran Koradia" <no****@microso ft.com> wrote in message
news:uZ******** ******@TK2MSFTN GP12.phx.gbl...
If I understand correctly, you're trying to catch the WM_CLOSE of another
app (app2) in your app (app1), right? As far as I know, I don't think you
can catch events raised in one application from another application if that is in fact what you are implying. However, I may be wrong.
Any specific reason why you want to it this way? Maybe there's some other
way to accomplish what you are attempting to do. A little more detail might help..

Imran.

"Steven" <no****@spam.co m> wrote in message
news:uO******** ******@tk2msftn gp13.phx.gbl...
Thanks, Imran, that's basically the idea, but I need to do it for another
application. Imagine this scenario: my app (app1) is running, another app (app2) is running. App2 is closed by user interaction and WM_CLOSE is
generated. App1 needs to catch the WM_CLOSE, determine who it is destined for, and respond accordingly by updating it's app1 application display.

Any
ideas?

Steve

"Imran Koradia" <no****@microso ft.com> wrote in message
news:uG******** *****@TK2MSFTNG P11.phx.gbl...
maybe this will help..

http://msdn.microsoft.com/library/de...dproctopic.asp

Imran.

"Steven" <no****@spam.co m> wrote in message
news:ex******** ******@TK2MSFTN GP09.phx.gbl...
> Hello,
> Does anyone have any code that will catch a WM_CLOSE message (or any > window message) sent to another application?
>
> TIA,
> Steve
>
>



Nov 20 '05 #7
On Fri, 30 Jul 2004 18:39:56 -0000, Steven wrote:
Thanks, Imran, that's basically the idea, but I need to do it for another
application. Imagine this scenario: my app (app1) is running, another app
(app2) is running. App2 is closed by user interaction and WM_CLOSE is
generated. App1 needs to catch the WM_CLOSE, determine who it is destined
for, and respond accordingly by updating it's app1 application display. Any
ideas?


What you're trying to accomplish is called a cross process hook, and is
possible using the API call SetWindowsHookE x. The problem is that you will
not be able to do this directly from VB.NET. A cross process hook requires
the hook callback function to reside in a standard dll - which means you
must create that function using C/C++ or another language that supports
creation of those dll's. You can then tie into your dll, via P/Invoke.

--
Tom Shelton [MVP]
Nov 20 '05 #8
The technique mentioned by Tom will work in real time and will be quite
efficient. If you can do away with a little delay, you could use a seperate
thread to poll your apps (processes) from within your Auto Start app say
every 0.5 to 1 sec and update your process/app list accordingly. This
shouldn't be too wasteful and should be good enough to appear real time for
us humans :)

hope this helps..
Imran.

"Tom Shelton" <to*@YOUKNOWTHE DRILLmtogden.co m> wrote in message
news:m0******** *************** *****@40tude.ne t...
On Fri, 30 Jul 2004 18:39:56 -0000, Steven wrote:
Thanks, Imran, that's basically the idea, but I need to do it for another application. Imagine this scenario: my app (app1) is running, another app (app2) is running. App2 is closed by user interaction and WM_CLOSE is
generated. App1 needs to catch the WM_CLOSE, determine who it is destined for, and respond accordingly by updating it's app1 application display. Any ideas?

What you're trying to accomplish is called a cross process hook, and is
possible using the API call SetWindowsHookE x. The problem is that you

will not be able to do this directly from VB.NET. A cross process hook requires the hook callback function to reside in a standard dll - which means you
must create that function using C/C++ or another language that supports
creation of those dll's. You can then tie into your dll, via P/Invoke.

--
Tom Shelton [MVP]

Nov 20 '05 #9
On Fri, 30 Jul 2004 18:39:56 -0000, Steven wrote:
Thanks, Imran, that's basically the idea, but I need to do it for another
application. Imagine this scenario: my app (app1) is running, another app
(app2) is running. App2 is closed by user interaction and WM_CLOSE is
generated. App1 needs to catch the WM_CLOSE, determine who it is destined
for, and respond accordingly by updating it's app1 application display. Any
ideas?


What you're trying to accomplish is called a cross process hook, and is
possible using the API call SetWindowsHookE x. The problem is that you will
not be able to do this directly from VB.NET. A cross process hook requires
the hook callback function to reside in a standard dll - which means you
must create that function using C/C++ or another language that supports
creation of those dll's. You can then tie into your dll, via P/Invoke.

--
Tom Shelton [MVP]
Nov 20 '05 #10

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

Similar topics

1
7378
by: BadOmen | last post by:
I am using the GetActiveWindow() API but it returns 0 I have a remote that I activate this code with: Code: WinAmpHandler = GetActiveWindow WinAMPhWnd = FindWindow("Winamp v1.x", vbNullString) I have the WinAmp window active but the GetActiveWindow returns a 0 instead of the window handler, way?
2
3280
by: zapazap | last post by:
Dear Snake Charming Gurus, (Was: http://mail.python.org/pipermail/python-list/2004-January/204454.html) First, a thank you to Tim Golden, Thomas Heller, and Mark Hammond for your earlier help with this problem. I am uncertain about what etiquette calls for, but more on that later. My Objective: I am trying to control the _VMWare Desktop_ application
4
4831
by: Ronny Sigo | last post by:
Hello all, Below is a testroutine. I am trying to open and cclose iexplore programmatically (the default startpage is suffcient, no need to specify another) The opening works, but the closing does not ... can anybody tell me what I am doing wrong? Many thanks, Ronny Sigo Private Declare Function GetForegroundWindow Lib "user32" () As Long Private Declare Function SendMessage Lib "user32" Alias "SendMessageA"
5
3180
by: Ronny Sigo | last post by:
Hello all, I try to open and close a webpage (when timer ticks) The problem is that it won't close ... Can anybody see what I am doing wrong? I'll paste the code here ... Any help very much appreciated .... Thanks Ronny Declarations: Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal
8
21613
by: MrNobody | last post by:
How do I change a window's behavior so when someone clicks the little 'X' in the upper right corner it actually hides the dialog, instead of disposing it?
5
2914
by: Tony | last post by:
Hi, I am looking for the opposite of wm_close, I assume it's possibly wm_open but no info comes up with that term. so, what is the opposite of WM_Close Any ideas welcome Tony
9
16161
by: SeC | last post by:
Hi. Is there any way to detect if application is being killed by 'End Process' via Task Manager ?
0
1886
by: ah.ping.luk | last post by:
Dear All, i want to catch the application event (WM_CLOSE) in a user control. i create a class that implement the IMessageFIlter interface as follow: '=================================================== Imports System.Windows.Forms
2
5325
by: ShadowLocke | last post by:
Im not sure if this is possible, but i would like to send a wm_close message to a window, and if this window is for instance mspaint and it prompts "close without saving" Is there a way I can detect if the user canceled or not? Im not tied to sendmessage so any other technique/idea i am happy to listen.
0
9690
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9550
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10501
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10250
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
10032
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9085
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6811
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5603
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3764
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.