- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
?My Fortran code is compiled as a windows program with an event loop. The event loop handles
the WM_DESTROY message which is used to abort the run when the GUI wants to kill it.
When performing heavy computations, this abort only works sporadically. I think that the
Windows message cue fills up and the events are not handled.
Is there a way to force it to handle cued messages? Is there some other means that I should use to
externally abort the program? I would rather not deal with any mixed/C language calls.
the WM_DESTROY message which is used to abort the run when the GUI wants to kill it.
When performing heavy computations, this abort only works sporadically. I think that the
Windows message cue fills up and the events are not handled.
Is there a way to force it to handle cued messages? Is there some other means that I should use to
externally abort the program? I would rather not deal with any mixed/C language calls.
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What's your message loop like? You're supposed to catch WM_DESTROY in MainWndProc and call PostQuitMessage(0) on that.
But, in general, heavy computations don't fit well with message loops -- when the code is single-threaded it can execute either message loop or the computation but one or another must wait for the other to complete.
ThreadDlg sample on my home page offers a solution with a worker thread; it is not exactly the same as your problem but you may want to take a look at it.
Jugoslav
But, in general, heavy computations don't fit well with message loops -- when the code is single-threaded it can execute either message loop or the computation but one or another must wait for the other to complete.
ThreadDlg sample on my home page offers a solution with a worker thread; it is not exactly the same as your problem but you may want to take a look at it.
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - steve999
?My Fortran code is compiled as a windows program with an event loop. The event loop handles
the WM_DESTROY message which is used to abort the run when the GUI wants to kill it.
When performing heavy computations, this abort only works sporadically. I think that the
Windows message cue fills up and the events are not handled.
Is there a way to force it to handle cued messages? Is there some other means that I should use to
externally abort the program? I would rather not deal with any mixed/C language calls.
the WM_DESTROY message which is used to abort the run when the GUI wants to kill it.
When performing heavy computations, this abort only works sporadically. I think that the
Windows message cue fills up and the events are not handled.
Is there a way to force it to handle cued messages? Is there some other means that I should use to
externally abort the program? I would rather not deal with any mixed/C language calls.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - kooka
I recomend you to change all windows management of your program to write in more Object oriented languajes, like VB or C#. I made a Windows program like you in fortran and was a very troble dealing with windows. ...
The foregoing comment is entirely a matter of opinion (and experience, or lack thereof). If you take the trouble to learn how Windows works, then full-bore Win32 API programs written in Fortran are no more difficult than in any other language and there is no aspect of Win32 programming which cannot be done entirely in Fortran. This avoids the complexity of mixed-language programming (probably 20% of the threads in this forum are about problems with argument passing between Fortran and other languages).
As noted in other replies, you need to put your computation in a separate thread from the winmain message loop.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Paul Curtis
Jeez, I just realized the original post in this thread was from 2002! Why are we still talking about this?
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