Pelles C forum

Pelles C => Feature requests => Topic started by: frankie on April 27, 2014, 07:32:56 PM

Title: IdeSpawn
Post by: frankie on April 27, 2014, 07:32:56 PM
Hi Pelle,
thanks for the new release 3.
I would propose an upgrade for IdeSpawn.
Recently working with GUI/console programs I experienced a problem related to the hiding of the console window. In this case if the program terminates normally (without an ExitProcess directive) the IdeSpawn remain active in the background and have to be killed with the task manager.
Maybe it's not a big deal to add code to restore console window when the program ends.
Title: Re: IdeSpawn
Post by: Pelle on May 03, 2014, 11:46:10 AM
The console window was a big problem in the past, at least. Hence the use of idespawn, with additional support in the debugger. Some console functions have been added to the Windows API that may help, but I have to look at it. Windows XP may be problem too.
Title: Re: IdeSpawn
Post by: frankie on May 03, 2014, 12:00:55 PM
Thanks Pelle.
The console is a big issue indeed, my experimentation allocating a console from inside a GUI program gave very bad results, that's why I choosed the way around for my apps: start a console app then creates windows.  >:(
But in my case I deliberately hided the window to use console in GUI programs (mainly because printf and the like seems to be blocking I/O and this locks output and input when used in multithreaded envs).
So as first suggestion I just asked to add a ShowWindow call before printing the message "press any key..." to be sure that such a practice done by a beginner can lead to posts abuot bugs (i.e. Idespawn continues to run....).
Title: Re: IdeSpawn
Post by: Pelle on May 03, 2014, 12:16:07 PM
I will look at it, but I can't promise anything.
Title: Re: IdeSpawn
Post by: frankie on May 03, 2014, 12:31:48 PM
Thanks  :)
Title: Re: IdeSpawn
Post by: jj2007 on May 03, 2014, 03:08:10 PM
Just for fun: put this at the end, below WinMain's closing bracket:

#pragma comment(linker, "-subsystem:console")
int main(void) {
   WinMain(GetModuleHandle(0), 0, 0, SW_SHOW);
}


Test it with a printf("Hello"); in the WM_CREATE handler.