473,406 Members | 2,451 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,406 software developers and data experts.

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 3290
maybe this will help..
http://msdn.microsoft.com/library/de...dproctopic.asp

Imran.

"Steven" <no****@spam.com> wrote in message
news:ex**************@TK2MSFTNGP09.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****@microsoft.com> wrote in message
news:uG*************@TK2MSFTNGP11.phx.gbl...
maybe this will help..
http://msdn.microsoft.com/library/de...dproctopic.asp
Imran.

"Steven" <no****@spam.com> wrote in message
news:ex**************@TK2MSFTNGP09.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.com> wrote in message
news:uO**************@tk2msftngp13.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****@microsoft.com> wrote in message
news:uG*************@TK2MSFTNGP11.phx.gbl...
maybe this will help..

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

Imran.

"Steven" <no****@spam.com> wrote in message
news:ex**************@TK2MSFTNGP09.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.com> wrote in message
news:uO**************@tk2msftngp13.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****@microsoft.com> wrote in message
news:uG*************@TK2MSFTNGP11.phx.gbl...
maybe this will help..

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

Imran.

"Steven" <no****@spam.com> wrote in message
news:ex**************@TK2MSFTNGP09.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(app2) closes so that I may update app1's GUI. I have
applications that run 24/7. I am writing another application(AutoStart.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****@microsoft.com> wrote in message
news:uZ**************@TK2MSFTNGP12.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.com> wrote in message
news:uO**************@tk2msftngp13.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****@microsoft.com> wrote in message
news:uG*************@TK2MSFTNGP11.phx.gbl...
maybe this will help..

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

Imran.

"Steven" <no****@spam.com> wrote in message
news:ex**************@TK2MSFTNGP09.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(app2) closes so that I may update app1's GUI. I have
applications that run 24/7. I am writing another application(AutoStart.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****@microsoft.com> wrote in message
news:uZ**************@TK2MSFTNGP12.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.com> wrote in message
news:uO**************@tk2msftngp13.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****@microsoft.com> wrote in message
news:uG*************@TK2MSFTNGP11.phx.gbl...
maybe this will help..

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

Imran.

"Steven" <no****@spam.com> wrote in message
news:ex**************@TK2MSFTNGP09.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 SetWindowsHookEx. 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*@YOUKNOWTHEDRILLmtogden.com> wrote in message
news:m0****************************@40tude.net...
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 SetWindowsHookEx. 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 SetWindowsHookEx. 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
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*@YOUKNOWTHEDRILLmtogden.com> wrote in message
news:m0****************************@40tude.net...
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 SetWindowsHookEx. 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 #11
Imran, Tom,
Thanks for your replies. I had hoped to avoid the polling method. We
have some C++ guys here, maybe they can whip up a dll or something in short
order.

Thanks again,
Steven

"Imran Koradia" <no****@microsoft.com> wrote in message
news:O9**************@TK2MSFTNGP09.phx.gbl...
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*@YOUKNOWTHEDRILLmtogden.com> wrote in message
news:m0****************************@40tude.net...
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 SetWindowsHookEx. 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 #12

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

Similar topics

1
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",...
2
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...
4
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...
5
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...
8
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
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
by: SeC | last post by:
Hi. Is there any way to detect if application is being killed by 'End Process' via Task Manager ?
0
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: ...
2
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...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
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,...

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.