flat assembler
Message board for the users of flat assembler.

Index > IDE Development > FASMW behaviour when running console apps

Author
Thread Post new topic Reply to topic
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard
When I ran a DOS program from FASMW, the console didn't close after program finished. It closes when running win32 console APP.
Post 22 Nov 2005, 14:29
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7801
Location: Kraków, Poland
Tomasz Grysztar
It's the partially implemented requested feature; which I have yet tested only on XP. I got one report that it doesn't work as expected in Win98, so I think I will remove it anyway. What I tried to achieve (due to request) was to keep the console window open always even when the program terminates, so you wouldn't have to add some waiting-for-key at the end of your program to see what it displayed. However it appeared to be harder than I thought.
Post 22 Nov 2005, 14:44
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
what happens when you just disable reactions to WM_CLOSE in wndproc, until user presses enter (WM_INPUT)?
Post 22 Nov 2005, 15:00
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard
I'm thinking of implementing this feature in Fresh too, but only as an option that can be disabled.
Post 22 Nov 2005, 15:10
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7801
Location: Kraków, Poland
Tomasz Grysztar
The main problem I encountered is that when you attach console to some process, clicking the close button on console window terminates that process without sending any message, and I found no way to catch such event. You can catch the Ctrl+C and similar ones, but closing the console window with mouse seems to be impossible to catch with such simple methods.
Post 22 Nov 2005, 16:08
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
If i understand right then console window is handled by windows and only sends some of messages to you...

can't you somehow overload console window class, eg. make your own class where you in wndproc catch these window messages and pass others to original handler?
Post 22 Nov 2005, 17:16
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
I found this function in the windows SDK.
Could this be what you are looking for?
Quote:

The SetConsoleCtrlHandler function adds or removes an application-defined HandlerRoutine function from the list of handler functions for the calling process.

If no handler function is specified, the function sets an inheritable attribute that determines whether the calling process ignores CTRL+C signals.


BOOL SetConsoleCtrlHandler( PHANDLER_ROUTINE HandlerRoutine, BOOL Add);

Parameters
HandlerRoutine
[in] Pointer to the application-defined HandlerRoutine function to add or remove. This parameter can be NULL.
Windows Me/98/95: This parameter cannot be NULL.
Add
[in] If this parameter is TRUE, the handler is added; if it is FALSE, the handler is removed.
If the HandlerRoutine parameter is NULL, a TRUE value causes the calling process to ignore CTRL+C input, and a FALSE value restores normal processing of CTRL+C input. This attribute of ignoring or processing CTRL+C is inherited by child processes.
Post 25 Nov 2005, 21:15
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7801
Location: Kraków, Poland
Tomasz Grysztar
This is what I was talking about - you can catch the Ctrl+C and Ctrl+Break this way, but when someone clicks the X button to close the console window, the whole application gets closed without touching that handler and I was not able to find a way of cancelling this operation.
Post 25 Nov 2005, 21:26
View user's profile Send private message Visit poster's website Reply with quote
Reverend



Joined: 24 Aug 2004
Posts: 408
Location: Poland
Reverend
Have you tried SetWindowsHookEx? Maybe WH_SYSMSGFILTER or other hook will help?
Post 26 Nov 2005, 23:46
View user's profile Send private message Visit poster's website Reply with quote
RedGhost



Joined: 18 May 2005
Posts: 443
Location: BC, Canada
RedGhost
Tomasz Grysztar wrote:
It's the partially implemented requested feature; which I have yet tested only on XP. I got one report that it doesn't work as expected in Win98, so I think I will remove it anyway. What I tried to achieve (due to request) was to keep the console window open always even when the program terminates, so you wouldn't have to add some waiting-for-key at the end of your program to see what it displayed. However it appeared to be harder than I thought.


pelles c does that for me, very useful feature (imo)

_________________
redghost.ca
Post 01 Dec 2005, 20:19
View user's profile Send private message AIM Address MSN Messenger Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.