- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Compiler : Compaq Visual Fortran 6.6.0
I have a QuickWin application and I would like to perform an action when the user close the application via the Close Button of the Window ( at the right top of the window).
Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is a CVF sample file which does this .... look under
.....SAMPLESQUICKWINMENUDRIV
David Jones
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, thank you but with that example I can remove the possibility of pushing on the
but what I would like to do is to allow the user to push on the button and perform some action before the application close.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need to insert some code ... for example look for HCBT_SYSCOMMAND and insert a few lines into the code after it ...
if((nCode.eq.HCBT_SYSCOMMAND).and.(wParam.eq.SC_CLOSE)) then
write(*,3000)
3000 format(/ 'Close pressed ---- ')
stoprun=1
CBTProc = 1 ! we have processed the message so discard it.
return
endif
where "stoprun" is a variable passed via common block or module. Then in your main Quickwin code, test for whether "stoprun" is set to 1, and stop the program. Otherwise put the test in the sort of thread that the example sets up. Or put your extra code inside the if()then... endif and allow the program to stop from there by not setting CBTProc = 1 in the above.
David Jones- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't have time to look at the above mentioned sample, but ain't subclassing and handling WM_CLOSE much simpler way than installing a WH_CBT hook? OK, hooks are not that complicated, but they look like overkill to me.
You can find numerous posts re subclassing in this Forum -- search for "subclassing" and/or "GWL_WNDPROC".
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a lot :smileyhappy:

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page