News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

IdeSpawn

Started by frankie, April 27, 2014, 07:32:56 PM

Previous topic - Next topic

frankie

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.
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

Pelle

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.
/Pelle

frankie

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....).
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

Pelle

I will look at it, but I can't promise anything.
/Pelle

frankie

"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

jj2007

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.