Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28867 Discussions

How to handle WM_CLOSE signal or event?

mostlyAtNight
Beginner
2,014 Views
Hello All,

I'm having some issues with a QuickWin application I'm working with.

When the window is closed using the x in the top right corner, the window closes, but the process remains active consuming CPU cycles.

I have tried using SIGNALQQ to capture the signal generated by closing the window but none of the following signals are matched:

SIG$INT
SIG$ABORT
SIG$ILL
SIG$SEGV
SIG$TERM

Is there a way of catching a signal generated when the window is closed so I can close the application down properly?

Any help would be much appreciated.

Kind regards,

Pete
0 Kudos
1 Solution
Paul_Curtis
Valued Contributor I
2,014 Views
Quoting - mostlyAtNight
I'm reasonably sure the message generated by clicking the x in the top right hand corner will be a WM_CLOSE message - any idea how to trap that in FORTRAN?

Yes, write your own proc for your Windows program and don't use quickwin.

View solution in original post

0 Kudos
5 Replies
onkelhotte
New Contributor II
2,014 Views
I have seen this behaviour from time to time at my projects myself. The process stays in memory and allocates more and more RAM.

But I cannot reproduce or explain it.

Markus
0 Kudos
anthonyrichards
New Contributor III
2,015 Views
Quoting - onkelhotte
I have seen this behaviour from time to time at my projects myself. The process stays in memory and allocates more and more RAM.

But I cannot reproduce or explain it.

Markus

Look for the application SPYXX.EXE, which is usually installed along with Microsoft Visual Studio/Developer Studio and can be found in directory such as /program files/microsoft visual studio/common/tools/. This free application allows you to 'find' a window and start logging messages sent to it by the system, so you can follow what happens when you issue the WM_CLOSE message, or any other message.
0 Kudos
mostlyAtNight
Beginner
2,015 Views
Quoting - anthonyrichards

Look for the application SPYXX.EXE, which is usually installed along with Microsoft Visual Studio/Developer Studio and can be found in directory such as /program files/microsoft visual studio/common/tools/. This free application allows you to 'find' a window and start logging messages sent to it by the system, so you can follow what happens when you issue the WM_CLOSE message, or any other message.
Hi there,

Thanks for your response, I tried using this utility but each time I selected the main window of my program to try and recieve messages I keep getting the messge:

Spy++ has encountered a problem in the message hook. To prevent hanging the system, the hook has been disabled.....

I'm reasonably sure the message generated by clicking the x in the top right hand corner will be a WM_CLOSE message - any idea how to trap that in FORTRAN?

Regards,

Pete
0 Kudos
Paul_Curtis
Valued Contributor I
2,015 Views
Quoting - mostlyAtNight
I'm reasonably sure the message generated by clicking the x in the top right hand corner will be a WM_CLOSE message - any idea how to trap that in FORTRAN?

Yes, write your own proc for your Windows program and don't use quickwin.
0 Kudos
mostlyAtNight
Beginner
2,015 Views
Quoting - Paul Curtis

Yes, write your own proc for your Windows program and don't use quickwin.

Hi Paul,

Thanks for your advice, I think this will be the route we'll be taking.

Regards,

Pete
0 Kudos
Reply