How can I simulate these calls inside a program? Like say I want to find all the active connections. So I want to use netstat -a How could I use that without having to literally having a window open?
4 Answers
Use CreateProcess, redirecting the output.
If the calling application is not a windows application there is no issue with a console window (because a console programming will, by default, inheirt its parent console).
If the calling application is a windows application, set the right options passed to CreateProcess to default the console window that will be created to hidden.