Hide console window after system()

I thought this would be super simple, but I can't get find a way to do it:

I use system("kwerpotutorial.pdf"); to open the pdf file.
This open a console window as well.
How do I prevent that?

Thanks in advance.
closed account (Dy7SLyTq)
i dont think you understand what system does...
http://www.lmgtfy.com/?q=c+system&l=1
That's right, but I was convinced I got it to work with system in the past.

Anyway, I got it to work with ShellExecute.
That page describes system as 'execute a shell command', so that confused me.
Make use of Showwindow() API Function.

closed account (13bSLyTq)
Hi,

Using ShellExecute is not ideally a good idea, mostly as ShellExecute can be exploited fairly easily to create a Buffer Overflow. I would recommend, you using CreateProcess:

MSDN Documentation:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx

Good Luck
Topic archived. No new replies allowed.